@filestore/memory
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

FileStore - Memory

Store and retreive files in memory.

Installation

npm install --save @filestore/memory

Usage

const Memory = require('@filestore/memory')
const fs = require('fs')

const filestore = new Memory()
const file = fs.createReadStream('my-file.txt')

filestore.put('my-file.txt', file).then(() => {
  // "my-file.txt" is now stored in memory
})

API

The API is meant to be interchangeable with any other @filestore/... module.

new Memory([options])

Instantiates a new Memory FileStore class.

(as of now, no options exists)

.put(id: string, data: Input[, options: object]) => Promise<void>

Save a file in memory.

data can be a ReadableStream, Buffer, string, Iterable<Buffer|string> or Promise.

.get(id: string) => ReadableStream

Fetch a file from memory.

.has(id: string) => Promise<boolean>

Check if a file exists in memory.

Dependents (0)

Package Sidebar

Install

npm i @filestore/memory

Weekly Downloads

0

Version

0.1.0

License

MIT

Last publish

Collaborators

  • cstruct
  • linusu