Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
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
// All below settings are optional, and their default is whats shown here
lFiles.dataWriter.mode = 'noSync'; // or 'slave' or 'master'
lFiles.dataWriter.intercom = new require('larvitamintercom')('loopback interface');
lFiles.dataWriter.amsync = {'host': null, 'minPort': null, 'maxPort': null};
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');
});
});
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.
});
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.filter.operator = 'and'; // or 'or'. 'and' is default
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 344 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
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.