🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

zstd.ts

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zstd.ts

compress and decompress using system-installed zstd and unzstd

1.1.3
latest
Source
npm
Version published
Weekly downloads
5.2K
-1.62%
Maintainers
1
Weekly downloads
 
Created
Source

zstd.ts

compress and decompress using system-installed zstd and unzstd

npm Package Version

Features

  • Typescript support
  • Support sync mode
  • Support async mode
  • Tested with mocha
  • No dependency on other packages

Usage Example

import { compress, decompress } from 'zstd.ts'
import { compressSync, decompressSync } from 'zstd.ts'

let compressed: Buffer = compressSync({ input: 'test' })
let uncompressed: Buffer = decompressSync({ input: compressed })
let matched = uncompressed.toString() == 'test'
console.log(matched) // true

Typescript Signature

export type CompressOptions = {
  compressLevel?: number // range: 1 - 19 (default level is 3)
  input: string | Buffer
}

export function compressSync(options: CompressOptions): Buffer

export function compress(options: CompressOptions): Promise<Buffer>
export function compress(
  options: CompressOptions,
  callback: (error: any, buffer: Buffer) => void,
): void

export type DecompressOptions = {
  input: Buffer
}

export function decompressSync(options: DecompressOptions): Buffer

export function decompress(options: DecompressOptions): Promise<Buffer>
export function decompress(
  options: DecompressOptions,
  callback: (error: any, buffer: Buffer) => void,
): void

License

This project is licensed with BSD-2-Clause

This is free, libre, and open-source software. It comes down to four essential freedoms [ref]:

  • The freedom to run the program as you wish, for any purpose
  • The freedom to study how the program works, and change it so it does your computing as you wish
  • The freedom to redistribute copies so you can help others
  • The freedom to distribute copies of your modified versions to others

Keywords

zstd

FAQs

Package last updated on 09 Oct 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts