@dynamix/fs
v0.0.0
Published
File System for Dynamix
Downloads
6
Maintainers
Readme
@dynamix/fs
Dynamix filesystem utilities. This package is a utility package for handling file transfer between the host and the webview.
This package is compatible with
- [x] React Native
- [x] React
- [x] Vue
- [x] Other JS frameworks
Installation
yarn add @dynamix/fs
Usage
Below example is using React for host and React Native for webview.
// WEB NextJS
// mypage/page.tsx
import { useDynamix } from "@dynamix/react";
function WebMyPage(){
const [photo, setPhoto] = useState(null);
const onPhotoSelectClick = usePhotoPicker({
readAs: "DataURL",
multiple: false,
onLoad: setPhoto
});
return (
<Avatar onClick={onPhotoSelectClick} src={photo}/>
)
}
// WEBVIEW on React Native
// pages/mypage.tsx
import { WebView } from "@dymamix/react-native";
import fs from "@dynamix/fs";
function AppMyPage() {
return (
<Webview>
<DynamixFSProvider fs={fs}/>
</WebView>
)
}