A file system backend by a zip file. Implemented according to the standard: http://pkware.com/documents/casestudies/APPNOTE.TXT

While there are a few zip libraries for JavaScript (e.g. JSZip and zip.js), they are not a good match for ZenFS. In particular, these libraries perform a lot of unneeded data copying, and eagerly decompress every file in the zip file upon loading to check the CRC32. They also eagerly decode strings. Furthermore, these libraries duplicate functionality already present in ZenFS (e.g. UTF-8 decoding and binary data manipulation).

When the filesystem is instantiated, we determine the directory structure of the zip file as quickly as possible. We lazily decompress and check the CRC32 of files.

Current limitations:

  • No encryption.
  • No ZIP64 support.
  • Read-only. Write support would require that we:
    • Keep track of changed/new files.
    • Compress changed files, and generate appropriate metadata for each.
    • Update file offsets for other files in the zip file.
    • Stream it out to a location. This isn't that bad, so we might do this at a later date.

Hierarchy

  • ReadonlyMixin & AsyncFSMethods & FileSystem<this>
    • ZipFS

Constructors

  • Parameters

    • label: string
    • data: Uint8Array

    Returns ZipFS

Properties

_mountPoint?: string

The last place this file system was mounted

_time: number = ...
_uuid: `${string}-${string}-${string}-${string}-${string}`

The UUID of the file system.

attributes: ConstMap<FileSystemAttributes, keyof FileSystemAttributes, void> & Map<
    string,
    any,
>

FileSystemAttributes

data: Uint8Array
directories: Map<string, Set<string>> = ...
eocd: Header
files: Map<string, FileEntry> = ...
label: string
name: string

The name for this file system. For example, tmpfs for an in memory one

type: number

A unique ID for this kind of file system. Currently unused internally, but could be used for partition tables or something

Accessors

  • get uuid(): `${string}-${string}-${string}-${string}-${string}`
  • Returns `${string}-${string}-${string}-${string}-${string}`

Methods

  • Parameters

    • path: string
    • flag: string
    • mode: number

    Returns Promise<never>

  • Create the file at path with the given options.

    Parameters

    • path: string
    • options: CreationOptions

    Returns Promise<InodeLike>

  • Parameters

    • path: string
    • flag: string
    • mode: number

    Returns never

  • Create the file at path with the given options.

    Parameters

    • path: string
    • options: CreationOptions

    Returns InodeLike

  • Test whether or not path exists.

    Parameters

    • path: string

    Returns Promise<boolean>

  • Test whether or not path exists.

    Parameters

    • path: string

    Returns boolean

  • Parameters

    • srcpath: string
    • dstpath: string

    Returns Promise<never>

  • Parameters

    • target: string
    • link: string

    Returns Promise<void>

  • Parameters

    • srcpath: string
    • dstpath: string

    Returns never

  • Parameters

    • target: string
    • link: string

    Returns void

  • Parameters

    • path: string
    • mode: number

    Returns Promise<never>

  • Parameters

    • path: string
    • options: CreationOptions

    Returns Promise<InodeLike>

  • Parameters

    • path: string
    • mode: number

    Returns never

  • Parameters

    • path: string
    • options: CreationOptions

    Returns InodeLike

  • Reads into a buffer

    Parameters

    • path: string
    • buffer: Uint8Array

      The buffer to read into. You must set the byteOffset and byteLength appropriately!

    • start: number

      The offset into the file to start reading from

    • end: number

      The position in the file to stop reading

    Returns Promise<void>

  • Parameters

    • path: string

    Returns Promise<string[]>

  • Parameters

    • path: string

    Returns string[]

  • Reads into a buffer

    Parameters

    • path: string
    • buffer: Uint8Array

      The buffer to read into. You must set the byteOffset and byteLength appropriately!

    • offset: number
    • end: number

      The position in the file to stop reading

    Returns void

  • Returns Promise<void>

  • Parameters

    • oldPath: string
    • newPath: string

    Returns Promise<never>

  • Parameters

    • oldPath: string
    • newPath: string

    Returns Promise<void>

  • Parameters

    • oldPath: string
    • newPath: string

    Returns never

  • Parameters

    • oldPath: string
    • newPath: string

    Returns void

  • Parameters

    • path: string

    Returns Promise<never>

  • Parameters

    • path: string

    Returns Promise<void>

  • Parameters

    • path: string

    Returns never

  • Parameters

    • path: string

    Returns void

  • Parameters

    • path: string

    Returns Promise<InodeLike>

  • Parameters

    • path: string

    Returns Inode

  • Read a file using a stream.

    Parameters

    • path: string
    • options: StreamOptions

    Returns ReadableStream

  • Write a file using stream.

    Parameters

    • path: string
    • options: StreamOptions

    Returns WritableStream

  • Parameters

    • path: string

    Returns Promise<never>

  • Parameters

    • path: string

    Returns Promise<void>

  • Parameters

    • path: string

    Returns never

  • Parameters

    • path: string

    Returns void

  • Returns string

  • Parameters

    • path: string
    • metadata: Readonly<InodeLike>

    Returns Promise<never>

  • Modify metadata.

    Parameters

    • path: string
    • metadata: Partial<InodeLike>

    Returns Promise<void>

  • Parameters

    • path: string
    • metadata: Readonly<InodeLike>

    Returns never

  • Modify metadata.

    Parameters

    • path: string
    • metadata: Partial<InodeLike>

    Returns void

  • Parameters

    • path: string

    Returns Promise<never>

  • Parameters

    • path: string

    Returns Promise<void>

  • Parameters

    • path: string

    Returns never

  • Parameters

    • path: string

    Returns void

  • Experimental

    Default implementation.

    Returns UsageInfo

    Implement

  • Parameters

    • path: string
    • buffer: Uint8Array
    • offset: number

    Returns Promise<never>

  • Writes a buffer to a file

    Parameters

    • path: string
    • buffer: Uint8Array

      The buffer to write. You must set the byteOffset and byteLength appropriately!

    • offset: number

      The offset in the file to start writing

    Returns Promise<void>

  • Parameters

    • path: string
    • buffer: Uint8Array
    • offset: number

    Returns never

  • Writes a buffer to a file

    Parameters

    • path: string
    • buffer: Uint8Array

      The buffer to write. You must set the byteOffset and byteLength appropriately!

    • offset: number

      The offset in the file to start writing

    Returns void

MMNEPVFCICPMFPCPTTAAATR