mirror of
https://github.com/openziti/zrok.git
synced 2025-01-09 15:38:21 +01:00
1 line
6.0 KiB
JavaScript
1 line
6.0 KiB
JavaScript
"use strict";(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[732],{3905:(e,t,r)=>{r.d(t,{Zo:()=>p,kt:()=>m});var n=r(7294);function a(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function o(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){a(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function l(e,t){if(null==e)return{};var r,n,a=function(e,t){if(null==e)return{};var r,n,a={},i=Object.keys(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||(a[r]=e[r]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n<i.length;n++)r=i[n],t.indexOf(r)>=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(a[r]=e[r])}return a}var s=n.createContext({}),c=function(e){var t=n.useContext(s),r=t;return e&&(r="function"==typeof e?e(t):o(o({},t),e)),r},p=function(e){var t=c(e.components);return n.createElement(s.Provider,{value:t},e.children)},u="mdxType",d={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},h=n.forwardRef((function(e,t){var r=e.components,a=e.mdxType,i=e.originalType,s=e.parentName,p=l(e,["components","mdxType","originalType","parentName"]),u=c(r),h=a,m=u["".concat(s,".").concat(h)]||u[h]||d[h]||i;return r?n.createElement(m,o(o({ref:t},p),{},{components:r})):n.createElement(m,o({ref:t},p))}));function m(e,t){var r=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=r.length,o=new Array(i);o[0]=h;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l[u]="string"==typeof e?e:a,o[1]=l;for(var c=2;c<i;c++)o[c]=r[c];return n.createElement.apply(null,o)}return n.createElement.apply(null,r)}h.displayName="MDXCreateElement"},6984:(e,t,r)=>{r.r(t),r.d(t,{assets:()=>s,contentTitle:()=>o,default:()=>u,frontMatter:()=>i,metadata:()=>l,toc:()=>c});var n=r(7462),a=(r(7294),r(3905));const i={sidebar_position:30},o="Sharing Websites and Files",l={unversionedId:"concepts/files",id:"concepts/files",title:"Sharing Websites and Files",description:"With zrok it is possible to share files quickly and easily as well. To share files using zrok use",source:"@site/../docs/concepts/files.md",sourceDirName:"concepts",slug:"/concepts/files",permalink:"/docs/concepts/files",draft:!1,editUrl:"https://github.com/openziti/zrok/blob/main/docs/../docs/concepts/files.md",tags:[],version:"current",sidebarPosition:30,frontMatter:{sidebar_position:30},sidebar:"tutorialSidebar",previous:{title:"Sharing TCP and UDP Servers",permalink:"/docs/concepts/tunnels"},next:{title:"Open Source",permalink:"/docs/concepts/opensource"}},s={},c=[],p={toc:c};function u(e){let{components:t,...i}=e;return(0,a.kt)("wrapper",(0,n.Z)({},p,i,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"sharing-websites-and-files"},"Sharing Websites and Files"),(0,a.kt)("p",null,"With ",(0,a.kt)("inlineCode",{parentName:"p"},"zrok")," it is possible to share files quickly and easily as well. To share files using ",(0,a.kt)("inlineCode",{parentName:"p"},"zrok")," use\nthe ",(0,a.kt)("inlineCode",{parentName:"p"},"--backend-mode web"),", for example: ",(0,a.kt)("inlineCode",{parentName:"p"},"zrok share private . --backend-mode web"),"."),(0,a.kt)("p",null,"Running with this mode will make it trivially easy to share files from the directory which the command\nwas run from."),(0,a.kt)("p",null,"For example if you have a directory with a structure like this:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-shell"},"-rw-r--r--+ 1 Michael None 7090 Apr 17 12:53 CHANGELOG.md\n-rw-r--r--+ 1 Michael None 11346 Apr 17 12:53 LICENSE\n-rw-r--r--+ 1 Michael None 2885 Apr 17 12:53 README.md\n-rwxr-xr-x+ 1 Michael None 44250624 Apr 17 13:00 zrok.exe*\n")),(0,a.kt)("p",null,"The files can be shared using a command such as: "),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-shell"},"zrok share public --backend-mode web .\n")),(0,a.kt)("p",null,"Then the files can be access with a ",(0,a.kt)("inlineCode",{parentName:"p"},"private")," or ",(0,a.kt)("inlineCode",{parentName:"p"},"public")," share, for example as shown:"),(0,a.kt)("p",null,(0,a.kt)("img",{alt:"zrok_share_web_files",src:r(4054).Z,width:"952",height:"723"})),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"zrok")," will automatically provide a stock website, which will allow the accessing user to browse and navigate the file tree. Clicking the files allows the user to download them."),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"zrok")," can also share a pre-rendered static HTML website. If you have a directory like this:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-shell"},"-rw-rw-r--+ 1 Michael None 56 Jun 26 13:23 index.html\n")),(0,a.kt)("p",null,"If ",(0,a.kt)("inlineCode",{parentName:"p"},"index.html")," contains valid HTML, like this:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-html"},"<html>\n<body>\n <h1>Hello <code>zrok</code></h1>\n</html>\n")),(0,a.kt)("p",null,"Sharing the directory will result in the following when you access the share in a web browser:"),(0,a.kt)("p",null,(0,a.kt)("img",{alt:"zrok_share_web_website",src:r(9068).Z,width:"952",height:"723"})),(0,a.kt)("p",null,(0,a.kt)("inlineCode",{parentName:"p"},"zrok")," contains a built-in web server, which you can use to serve static websites as a share."))}u.isMDXComponent=!0},4054:(e,t,r)=>{r.d(t,{Z:()=>n});const n=r.p+"assets/images/zrok_share_web_files-936de420b39b071d71a8e275fe84e63d.png"},9068:(e,t,r)=>{r.d(t,{Z:()=>n});const n=r.p+"assets/images/zrok_share_web_website-5d4c550374b118d1992e488bb319e230.png"}}]); |