Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "yaz0/decompression"

Index

Functions

decompress

  • decompress(): Transform
  • Decompresses a stream that has been compressed via the Yaz0 algorithm.

    example
    createReadStream('ActorInfo.product.sbyml')
      .pipe(decompress())
      .pipe(createWriteStream('ActorInfo.product.byml'))

    Returns Transform

    A Transform stream that accepts compressed data and outputs decompressed data.

decompressBuffer

  • decompressBuffer(buffer: Buffer): Promise<Buffer>
  • decompressBuffer(buffer: Buffer, encoding: BufferEncoding): Promise<string>
  • Asynchronously decompresses the contents of a Buffer.

    example
    const compressedBuffer = await readFile('ActorInfo.product.sbyml')
    const decompressedBuffer = await decompressBuffer(compressedBuffer)
    await writeFile('ActorInfo.product.byml', decompressedBuffer)

    Parameters

    • buffer: Buffer

      The buffer to decompress.

    Returns Promise<Buffer>

    A Promise that resolves with a Buffer containing the decompressed data.

  • Asynchronously decompresses the contents of a Buffer.

    example
    const compressedBuffer = await readFile('ActorInfo.product.sbyml')
    const decompressedText = await decompressBuffer(compressedBuffer, 'utf8')
    await writeFile('ActorInfo.product.byml', decompressedText)

    Parameters

    • buffer: Buffer

      The buffer to decompress.

    • encoding: BufferEncoding

      The encoding of the data.

    Returns Promise<string>

    A Promise that resolves with a string containing the decompressed data.

decompressFile

  • decompressFile(path: PathLike): Promise<Buffer>
  • decompressFile(path: PathLike, options: { encoding: BufferEncoding }): Promise<string>
  • decompressFile(source: PathLike, destination: PathLike): Promise<void>
  • Asynchronously decompresses the entire contents of a file.

    example
    const buffer = await decompressFile('ActorInfo.product.sbyml')
    await writeFile('ActorInfo.product.byml', buffer)

    Parameters

    • path: PathLike

      The path to the compressed file.

    Returns Promise<Buffer>

    A Promise that resolves with a Buffer containing the decompressed contents of the file.

  • Asynchronously decompresses the entire contents of a file.

    example
    const text = await decompressFile('ActorInfo.product.sbyml', {encoding: 'utf8'})
    await writeFile('ActorInfo.product.byml', text)

    Parameters

    • path: PathLike

      The path to the compressed file.

    • options: { encoding: BufferEncoding }

      An object specifying the encoding.

      • encoding: BufferEncoding

        The encoding of the file.

    Returns Promise<string>

    A Promise that resolves with a string containing the decompressed contents of the file.

  • Asynchronously decompresses the entire contents of a file.

    example
    await decompressFile('ActorInfo.product.sbyml', 'ActorInfo.product.byml')

    Parameters

    • source: PathLike

      The path to the compressed file.

    • destination: PathLike

      The path to write the decompressed data to. If the file exists, it will be overwritten. If it is the same path as source, then it will overwrite the file at source.

    Returns Promise<void>

    A Promise that resolves when the compressed file has been decompressed and written.

Generated using TypeDoc