File System

gzip.mjs

@mr_ozio/scraper-utils · v2.5.0 · Generated April 21, 2026

Target Style

Target Style

4 exports

const

archiveFile

Target Style
export const archiveFile = async ({
  from,
  to,
  onProgress,
  removeOriginalFile = false,
  createDirectories = false,
} = {}) => {

Archives a file into gzip format.

Target style API. Preferred for new code.

Parameters

  • options{ from: string, to?: string, onProgress?: Function, removeOriginalFile?: boolean, createDirectories?: boolean }

Returns

Promise<void>

Example

await archiveFile({
  from: '/tmp/report.html',
  to: '/tmp/report.html.gz',
})

const

unarchiveFile

Target Style
export const unarchiveFile = async ({
  from,
  to,
  onProgress,
  removeOriginalFile = false,
  createDirectories = false,
} = {}) => {

Restores a gzip archive into a plain file.

Target style API. Preferred for new code.

Parameters

  • options{ from: string, to?: string, onProgress?: Function, removeOriginalFile?: boolean, createDirectories?: boolean }

Returns

Promise<void>

const

writeArchive

Target Style
export const writeArchive = async (contents, { to, createDirectories = false } = {}) => {

Writes archived contents to a gzip file.

Target style API. Preferred for new code.

Parameters

  • contentsstring
  • options{ to: string, createDirectories?: boolean }

Returns

Promise<void>

const

readArchive

Target Style
export const readArchive = async ({ from } = {}) => {

Reads text contents from a gzip archive.

Target style API. Preferred for new code.

Parameters

  • options{ from: string }

Returns

Promise<string>

Example

const html = await readArchive({
  from: '/tmp/report.html.gz',
})

Legacy Style

Legacy Style

0 exports

No legacy exports in this module.