You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
5.3 KiB
JavaScript
1 line
5.3 KiB
JavaScript
"use strict";(self.webpackChunkfurion=self.webpackChunkfurion||[]).push([[4507],{2584:(e,n,i)=>{i.r(n),i.d(n,{assets:()=>d,contentTitle:()=>l,default:()=>m,frontMatter:()=>r,metadata:()=>o,toc:()=>c});var t=i(5893),s=i(1151);const r={id:"fs",title:"13. FS \u9759\u6001\u7c7b",sidebar_label:"13. FS \u9759\u6001\u7c7b"},l=void 0,o={id:"global/fs",title:"13. FS \u9759\u6001\u7c7b",description:"13.1 \u83b7\u53d6\u7269\u7406\u6587\u4ef6\u63d0\u4f9b\u5668",source:"@site/docs/global/fs.mdx",sourceDirName:"global",slug:"/global/fs",permalink:"/docs/global/fs",draft:!1,unlisted:!1,editUrl:"https://gitee.com/dotnetchina/Furion/tree/v4/handbook/docs/global/fs.mdx",tags:[],version:"current",lastUpdatedBy:"MonkSoul",lastUpdatedAt:1681462280,formattedLastUpdatedAt:"Apr 14, 2023",frontMatter:{id:"fs",title:"13. FS \u9759\u6001\u7c7b",sidebar_label:"13. FS \u9759\u6001\u7c7b"},sidebar:"global",previous:{title:"12. SpareTime \u9759\u6001\u7c7b",permalink:"/docs/global/sparetime"},next:{title:"14. JWTEncryption \u9759\u6001\u7c7b",permalink:"/docs/global/jwt"}},d={},c=[{value:"13.1 \u83b7\u53d6\u7269\u7406\u6587\u4ef6\u63d0\u4f9b\u5668",id:"131-\u83b7\u53d6\u7269\u7406\u6587\u4ef6\u63d0\u4f9b\u5668",level:2},{value:"13.2 \u83b7\u53d6\u5d4c\u5165\u8d44\u6e90\u6587\u4ef6\u63d0\u4f9b\u5668",id:"132-\u83b7\u53d6\u5d4c\u5165\u8d44\u6e90\u6587\u4ef6\u63d0\u4f9b\u5668",level:2},{value:"13.3 \u83b7\u53d6\u6587\u4ef6\u63d0\u4f9b\u5668",id:"133-\u83b7\u53d6\u6587\u4ef6\u63d0\u4f9b\u5668",level:2},{value:"13.4 \u7279\u522b\u6ce8\u610f",id:"134-\u7279\u522b\u6ce8\u610f",level:2},{value:"13.5 \u83b7\u53d6\u6587\u4ef6 <code>ContentType</code> \u6216 <code>Mime</code>",id:"135-\u83b7\u53d6\u6587\u4ef6-contenttype-\u6216-mime",level:2},{value:"13.6 \u89e3\u51b3\u4e0d\u53d7\u652f\u6301\u7684\u6587\u4ef6 <code>MIME</code> \u7c7b\u578b",id:"136-\u89e3\u51b3\u4e0d\u53d7\u652f\u6301\u7684\u6587\u4ef6-mime-\u7c7b\u578b",level:2}];function a(e){const n={admonition:"admonition",code:"code",h2:"h2",p:"p",pre:"pre",...(0,s.a)(),...e.components};return(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(n.h2,{id:"131-\u83b7\u53d6\u7269\u7406\u6587\u4ef6\u63d0\u4f9b\u5668",children:"13.1 \u83b7\u53d6\u7269\u7406\u6587\u4ef6\u63d0\u4f9b\u5668"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers",children:'var fileProvider = FS.GetPhysicalFileProvider(@"c:/test");\n'})}),"\n",(0,t.jsx)(n.h2,{id:"132-\u83b7\u53d6\u5d4c\u5165\u8d44\u6e90\u6587\u4ef6\u63d0\u4f9b\u5668",children:"13.2 \u83b7\u53d6\u5d4c\u5165\u8d44\u6e90\u6587\u4ef6\u63d0\u4f9b\u5668"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers",children:"var fileProvider = FS.GetEmbeddedFileProvider(Assembly.GetEntryAssembly());\n"})}),"\n",(0,t.jsx)(n.h2,{id:"133-\u83b7\u53d6\u6587\u4ef6\u63d0\u4f9b\u5668",children:"13.3 \u83b7\u53d6\u6587\u4ef6\u63d0\u4f9b\u5668"}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers",children:'var fileProvider = FS.GetFileProvider(FileProviderTypes.Physical, @"c:/test");\n'})}),"\n",(0,t.jsx)(n.h2,{id:"134-\u7279\u522b\u6ce8\u610f",children:"13.4 \u7279\u522b\u6ce8\u610f"}),"\n",(0,t.jsxs)(n.p,{children:["\u4f7f\u7528\u8be5\u529f\u80fd\u9700\u786e\u4fdd ",(0,t.jsx)(n.code,{children:"services.AddVirtualFileServer()"})," \u5df2\u6ce8\u518c\u3002"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers",children:"services.AddVirtualFileServer();\n"})}),"\n",(0,t.jsxs)(n.h2,{id:"135-\u83b7\u53d6\u6587\u4ef6-contenttype-\u6216-mime",children:["13.5 \u83b7\u53d6\u6587\u4ef6 ",(0,t.jsx)(n.code,{children:"ContentType"})," \u6216 ",(0,t.jsx)(n.code,{children:"Mime"})]}),"\n",(0,t.jsx)(n.admonition,{title:"\u7248\u672c\u8bf4\u660e",type:"warning",children:(0,t.jsxs)(n.p,{children:["\u4ee5\u4e0b\u5185\u5bb9\u4ec5\u9650 ",(0,t.jsx)(n.code,{children:"Furion 3.3.1 +"})," \u7248\u672c\u4f7f\u7528\u3002"]})}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers",children:'var success = FS.TryGetContentType("image.png", out var contentType); // image/png\n'})}),"\n",(0,t.jsxs)(n.h2,{id:"136-\u89e3\u51b3\u4e0d\u53d7\u652f\u6301\u7684\u6587\u4ef6-mime-\u7c7b\u578b",children:["13.6 \u89e3\u51b3\u4e0d\u53d7\u652f\u6301\u7684\u6587\u4ef6 ",(0,t.jsx)(n.code,{children:"MIME"})," \u7c7b\u578b"]}),"\n",(0,t.jsxs)(n.p,{children:["\u89e3\u51b3\u4e0d\u53d7\u652f\u6301\u7684\u6587\u4ef6 ",(0,t.jsx)(n.code,{children:"MIME"})," \u51fa\u73b0 ",(0,t.jsx)(n.code,{children:"404"})," \u95ee\u9898\u3002"]}),"\n",(0,t.jsx)(n.pre,{children:(0,t.jsx)(n.code,{className:"language-cs",metastring:"showLineNumbers",children:"app.UseStaticFiles(new StaticFileOptions {\r\n ContentTypeProvider = FS.GetFileExtensionContentTypeProvider()\r\n})\n"})})]})}function m(e={}){const{wrapper:n}={...(0,s.a)(),...e.components};return n?(0,t.jsx)(n,{...e,children:(0,t.jsx)(a,{...e})}):a(e)}},1151:(e,n,i)=>{i.d(n,{Z:()=>o,a:()=>l});var t=i(7294);const s={},r=t.createContext(s);function l(e){const n=t.useContext(r);return t.useMemo((function(){return"function"==typeof e?e(n):{...n,...e}}),[n,e])}function o(e){let n;return n=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:l(e.components),t.createElement(r.Provider,{value:n},e.children)}}}]); |