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.
larvitfiles
Advanced tools
npm i larvitfiles;
const lFiles = require('larvitfiles'),
db = require('larvitdb'),
fs = require('fs');
db.setup(conf); // Only needed once per script. See https://github.com/larvit/larvitdb for details
fs.readFile('/some/file.txt', function (err, data) {
let file;
if (err) throw err;
file = new lFiles.File({
'slug': 'slug/foo/bar.txt',
'data': data,
'metadata': {'metadata1': 'metavalue1', 'metadata2': ['multiple', 'values']}
}, function (err) {
if (err) throw err;
file.save(function (err) {
if (err) throw err;
console.log('file saved with uuid: ' + file.uuid);
console.log('metadata: ' + JSON.stringify(file.metadata));
console.log('slug: ' + file.slug);
});
});
});
const lFiles = require('larvitfiles'),
db = require('larvitdb');
let file;
db.setup(conf); // Only needed once per script. See https://github.com/larvit/larvitdb for details
file = new lFiles.File({'slug': 'slug/foo/bar.txt'}, function (err) {
if (err) throw err;
console.log('file saved with uuid: ' + file.uuid);
console.log('metadata: ' + JSON.stringify(file.metadata));
console.log('slug: ' + file.slug);
// file data in file.data
});
const lFiles = require('larvitfiles'),
db = require('larvitdb');
let file;
db.setup(conf); // Only needed once per script. See https://github.com/larvit/larvitdb for details
file = new lFiles.File({'slug': 'slug/foo/bar.txt'}, function (err) {
if (err) throw err;
file.rm(function (err) {
if (err) throw err;
console.log('File is now removed from storage');
});
});
List all files
const lFiles = require('larvitfiles'),
db = require('larvitdb');
let files;
db.setup(conf); // Only needed once per script. See https://github.com/larvit/larvitdb for details
files = new lFiles.Files();
files.get(function (err, result) {
if (err) throw err;
console.log(result); // Object list of files, uuid as key and slugs, uuids and metadata, but NOT file data as values.
});
Filter list based on metadata
const lFiles = require('larvitfiles'),
db = require('larvitdb');
let files;
db.setup(conf); // Only needed once per script. See https://github.com/larvit/larvitdb for details
files = new lFiles.Files();
// This will only return files with metadata
// 1) "foo" = "bar" (and possibly other values as well)
// and
// 2) "zoo" = anything
files.filter.metadata.foo = 'bar';
files.filter.metadata.zoo = true;
files.get(function (err, result) {
if (err) throw err;
console.log(result); // Object list of files, uuid as key and slugs, uuids and metadata, but NOT file data as values.
});
And if several values should exist on a single metadata do this:
const lFiles = require('larvitfiles'),
db = require('larvitdb');
let files;
db.setup(conf); // Only needed once per script. See https://github.com/larvit/larvitdb for details
files = new lFiles.Files();
// This will only return files with metadata
// 1) "foo" = "bar" (and possibly other values as well)
// and
// 2) "foo" = "baz" (and possibly other values as well)
files.filter.metadata.foo = ['bar', 'baz'];
files.get(function (err, result) {
if (err) throw err;
console.log(result); // Object list of files, uuid as key and slugs, uuids and metadata, but NOT file data as values.
});
FAQs
Storage of files with an API and database to use in web environments
The npm package larvitfiles receives a total of 303 weekly downloads. As such, larvitfiles popularity was classified as not popular.
We found that larvitfiles 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.