![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
larvitfiles
Advanced tools
npm i larvitfiles;
const FileLib = require('larvitfiles');
const db = require('larvitdb');
const fs = require('fs');
db.setup(conf); // Only needed once per script. See https://github.com/larvit/larvitdb for details
const fileLib = new FileLib({
db: db,
storagePath: '/tmp/larvitfiles',
// All below settings are optional, and their default is whats shown here
log: new (new (require('larvitutils'))).Log(),
prefix: '/dbfiles/'
});
await fileLib.ready(); // Not needed to run actions, but no action will start until this is returning true
fs.readFile('/some/file.txt', function (err, data) {
let file;
if (err) throw err;
const file = await fileLib.save({
slug: 'slug/foo/bar.txt',
data: data,
metadata: {metadata1: 'metavalue1', metadata2: ['multiple', 'values']}, // optional, will erase previous metadata if left blank
//uuid: uuid() - optional
});
console.log('file saved with uuid: ' + file.uuid);
console.log('metadata: ' + JSON.stringify(file.metadata));
console.log('slug: ' + file.slug);
});
By default .save() will not accept a duplicate slug without also supplying a matching uuid.
If the below script is ran when a file with the slug "slug/foo/bar.txt" already exists in the database, this will throw an error.
const file = await fileLib.save({
slug: 'slug/foo/bar.txt',
data: Buffer.from('någe')
});
To overwrite the existing file, on the same uuid, use option "updateMatchingSlug":
const file = await fileLib.save({
slug: 'slug/foo/bar.txt',
data: Buffer.from('någe'),
updateMatchingSlug: true // Defaults to false
});
const file = await fileLib.get({slug: 'slug/foo/bar.txt'});
// or
const file = await fileLib.get({uuid: 'uuid of file'});
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
fileLib.rm(await fileLib.uuidFromSlug('slog/foo/bar.txt'));
console.log('File is now removed from storage');
const files = await fileLib.list();
console.log(result); // Array of objects with uuid, slugs and metadata, but NOT file data as values.
// This will only return files with metadata
// 1) "foo" = "bar" (and possibly other values as well)
// and
// 2) "zoo" = anything
const options = {
filter: {
metadata: {
foo: 'bar',
zoo: true
},
operator: 'and' // or 'or'. 'and' is default
}
};
const files = await fileLib.list(options);
console.log(files); // Array of objects with uuid, slugs and metadata, but NOT file data as values.
And if several values should exist on a single metadata do this:
// 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)
const options = {
filter: {
metadata: {
foo: ['bar', 'baz']
}
}
};
const files = await fileLib.list(options);
console.log(files); // Array of objects with uuid, slugs 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 71 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
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.