vfs-frontend
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

vfs-frontend

VFS-frontend is a simple virtual file system implemented purely on the frontend, where a virtual file system is built by simply passing blob binary data with a zip attribute,The JSZip library is used for parsing blob data

English | 简体中文

demo

https://ricbet.github.io/vfs-frontend/

how to use

const vfsService = new ZipVFSService();
 
vfsService.mount(blob).then(async () => {
    // do it
});
 

Now, vfsService has been mounted, for example

mount

The root directory defaults to '/', you can use the 'ls' method to view all files in a directory, for example

vfsService.ls('/').then((data: Inode[]) => {
    // do it
})
ls

🌈enjoy😊🌈

api

interface IVfsable<T> {
    mount(
        data: T,
        options?: {
            name: string;
        }
    ): Promise<never>;
 
    ls(path: string): Promise<Inode[]>;
 
    read(path: string, encode?: string): Promise<string | Error>;
 
    mkdir(path: string): Promise<Inode | Error>;
 
    touch(path: string): Promise<Inode | Error>;
 
    write(path: string, options: { isAppend: boolean }, content: string): Promise<never | Error>;
 
    exist(path: string): Promise<boolean>;
 
    cp(source: string, copyend: string): Promise<never | Error>;
 
    mv(source: string, target: string): Promise<never | Error>;
 
    rm(path: string, options: { isForce: boolean; isRecursive: boolean }): Promise<never | Error>;
 
    isMount: () => boolean;
 
    getBlob: () => Promise<Blob>;
}
 

license

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i vfs-frontend

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

505 kB

Total Files

10

Last publish

Collaborators

  • ricbet