npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

fs-gzip-blob-storage

v3.0.1

Published

Blob storage on filesystem, with gzip, streams and promises API

Downloads

86

Readme

fs-gzip-blob-storage

Build Status Coverage Status npm

Blob storage on filesystem, with gzip, streams and promises API.

This is a wrapper for fs-blob-storage

Requirements

This module requires ES6 with Node >= 10.

Installation

npm install fs-gzip-blob-storage

Additionally for Typescript:

npm install -D @types/node

Usage

const {FsGzipBlobStorage} = require("fs-gzip-blob-storage")

Typescript:

import FsGzipBlobStorage from "fs-gzip-blob-storage"
// or
import {FsGzipBlobStorage} from "fs-gzip-blob-storage"

DEFAULT_EXT

The default ext option is ''

DEFAULT_GZIP_EXT

The default gzipExt option is '.gz'

DEFAULT_PART

The default part option is '.part'

constructor

const storage = new FsGzipBlobStorage(options)

Options:

  • ext is a default ext argument for methods (optional, default: DEFAULT_EXT)
  • part is a default part argument for methods (optional, default: DEFAULT_PART)
  • exclusive if is true then can't create new object if already exists with the same key (optional, default: false)
  • gzipExt is an extra extension for gzipped files (optional, default: DEFAULT_GZIP_EXT)
  • gzipOptions is an object with options for gzip/gunzip (optional)
  • path is a directory path of the storage (optional, default: ".")

Example:

const storage = new FsGzipBlobStorage({
  path: "/usr/share/man",
  exclusive: true,
})

createWriteStream

const writable = await storage.createWriteStream(key, options)

Options:

  • ext is a default extension added to file name for the object (optional, default: this.ext)
  • part is a extension added to file name which can be later commited (optional, default: this.part)

Creates a writable stream for a new object in the storage. Object is gzipped and stored with the file name based on key and ext and gzipExt and part. Throws an error if has occurred and if the file already exists for exclusive mode.

createReadStream

const readable = await storage.createWriteStream(key, options)

Options:

  • ext is a default extension added to file name for the object (optional, default: this.ext)

Creates a readable stream for an existing, gunzipped object in the storage. Throws an error if has occurred or the object doesn't exist or its size is zero.

commit

await storage.commit(key, options)

Options:

  • ext is a default extension added to file name for the object (optional, default: this.ext)
  • part is a extension added to file name which can be later commited (optional, default: this.part)

Commits the object in the storage. It means that file name for the object is renamed and the additional extension for partial objects is removed. Throws an error if has occurred or the object doesn't exist.

remove

await storage.remove(key, options)

Options:

  • ext is a default extension added to file name for the object (optional, default: this.ext)

Removes the object from the storage. Throws an error if has occurred or the object doesn't exist.

License

Copyright (c) 2018-2020 Piotr Roszatycki [email protected]

MIT