New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@metarhia/filestorage

Package Overview
Dependencies
Maintainers
5
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@metarhia/filestorage

Metarhia File Storage

  • 0.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-50%
Maintainers
5
Weekly downloads
 
Created
Source

FileStorage

FileStorage is a library that allows to easily store a large number of binary files. Data will be spread across the file tree to optimize read and write speeds and can be accessed by a unique id. Large files can be compressed using either ZIP or GZIP and automatically decompressed on reading.

It is strongly recommended to use filestorage.create to get new FileStorage instance because it will also create a root directory if it does not yet exist in the file system.

Example with existing directory:

const { FileStorage } = require('filestorage');

const storage = new FileStorage({ dir: './root-directory', minCompressSize: 2048 });

Example with create:

const { create } = require('filestorage');

create({ dir: './root' }, (err, storage) => { ... });

Interface: filestorage

Create new FileStorage

FileStorage(options)

  • options: <Object>
    • dir: <string> data storage directory, which should be created before FileStorage is used
    • minCompressSize: <number> minimal file size to be compressed, default = 1024

Write file to storage

FileStorage.prototype.write(id, data, opts, cb)

Throws: <TypeError> if opts.checksum or opts.dedupHash is incorrect

Update or write file in the storage

FileStorage.prototype.update(id, data, opts, cb)

Throws: <TypeError> if opts.checksum or opts.dedupHash is incorrect

Get information about file

FileStorage.prototype.stat(id, cb)

Read file from storage

FileStorage.prototype.read(id, opts, cb)

Delete file from storage

FileStorage.prototype.rm(id, cb)

Compress file in storage

FileStorage.prototype.compress(id, compression, cb)

Throws: <TypeError> if compression is incorrect

Create new Filestorage and root directory if it doesn't exits

create(options, cb)

Keywords

FAQs

Package last updated on 23 Jan 2019

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc