Security News
PyPI’s New Archival Feature Closes a Major Security Gap
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
fs-blob-storage
Advanced tools
Blob storage on filesystem, with streams and promises API.
Features:
This module requires ES6 with Node >= 6.
npm install fs-blob-storage
Additionally for Typescript:
npm install -D @types/node
const { FsBlobStorage } = require('fs-blob-storage')
Typescript:
import FsBlobStorage from 'fs-blob-storage'
Transpiling this module with own settings in tsconfig.json
:
{
"compilerOptions": {
"paths": {
"fs-blob-storage": ["node_modules/fs-blob-storage/src/fs-blob-storage"]
}
}
}
The default ext
option is ''
The default part
option is '.part'
const storage = new FsBlobStorage(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
)fs
is a File System module (optional,
default: require('fs')
)path
is a directory path of the storage (optional, default: '.'
)Example:
const storage = new FsBlobStorage({
part: '.lock',
path: '/var/spool/mail',
exclusive: true
})
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
)encoding
is a encoding for created file (optional, default: null
)Creates a writable stream for a new object in the storage. Object is stored with
the file name based on key
and ext
and part
. Throws an error if has
occurred and if the file already exists for exclusive mode.
const readable = await storage.createWriteStream(key, options)
Options:
ext
is a default extension added to file name for the object (optional,
default: '')encoding
is a encoding for created file (optional, default: 'utf8')Creates a readable stream for an existing object in the storage. Throws an error if has occurred or the object doesn't exist or its size is zero.
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.
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.
This storage doesn't work correctly on NTFS filesystem mounted in Linux in VirtualBox. In this case no partial files should be used.
Copyright (c) 2018 Piotr Roszatycki piotr.roszatycki@gmail.com
v1.2.0 2018-09-07
DEFAULT_EXT
and DEFAULT_PART
are static readonly properties of
FsBlobStorage
class.FAQs
Blob storage on filesystem, with streams and promises API
The npm package fs-blob-storage receives a total of 135 weekly downloads. As such, fs-blob-storage popularity was classified as not popular.
We found that fs-blob-storage demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
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.
Security News
PyPI now allows maintainers to archive projects, improving security and helping users make informed decisions about their dependencies.
Research
Security News
Malicious npm package postcss-optimizer delivers BeaverTail malware, targeting developer systems; similarities to past campaigns suggest a North Korean connection.
Security News
CISA's KEV data is now on GitHub, offering easier access, API integration, commit history tracking, and automated updates for security teams and researchers.