New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

larvitfiles

Package Overview
Dependencies
Maintainers
3
Versions
142
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

larvitfiles - npm Package Compare versions

Comparing version 3.0.0 to 3.0.1

30

dbmigration/2.js
'use strict';
const logPrefix = 'larvitfiles: ./dbmigration/2.js: ',
lFiles = require(__dirname + '/../index.js'),
filesLib = require(__dirname + '/../index.js'),
lUtils = require('larvitutils'),

@@ -14,21 +14,21 @@ async = require('async'),

let files;
let files;
if (lFiles.storagePath === null) {
const e = new Error('storagePath not set on larvitfiles');
log.warn(logPrefix + e.message);
throw e;
if (filesLib.storagePath === null) {
const err = new Error('storagePath not set on larvitfiles');
log.warn(logPrefix + err.message);
throw err;
}
if ( ! fs.existsSync(lFiles.storagePath)) {
if ( ! fs.existsSync(filesLib.storagePath)) {
tasks.push(function (cb) {
log.info(logPrefix + 'storagePath "' + lFiles.storagePath + '" does not exist, creating');
fs.mkdir(lFiles.storagePath, cb);
log.info(logPrefix + 'storagePath "' + filesLib.storagePath + '" does not exist, creating');
fs.mkdir(filesLib.storagePath, cb);
});
}
// get list of slugs and uuids
// Get list of slugs and uuids
tasks.push(function (cb) {
db.query('SELECT uuid, slug FROM larvitfiles_files', function (err, rows) {
files = rows;
files = rows;
cb(err);

@@ -38,3 +38,3 @@ });

// write files to disk and save type in db
// Write files to disk and save type in db
tasks.push(function (cb) {

@@ -45,11 +45,11 @@ const tasks = [];

tasks.push(function (cb) {
db.query('SELECT data FROM larvitfiles_files WHERE uuid = ?', [lUtils.uuidToBuffer(file.uuid)], function (err, result) {
db.query('SELECT data FROM larvitfiles_files WHERE uuid = ?', file.uuid, function (err, result) {
if (err) return cb(err);
if (result.length === 0) {
log.warn(logPrefix + 'Could not find file with uuid "' + lUtils.formatUuid(file.uuid) + '"');
log.warn(logPrefix + 'Could not find file with uuid "' + Utils.formatUuid(file.uuid) + '"');
return cb();
}
fs.writeFile(lFiles.storagePath + '/' + lUtils.formatUuid(file.uuid), result[0].data, cb);
fs.writeFile(filesLib.storagePath + '/' + lUtils.formatUuid(file.uuid), result[0].data, cb);
});

@@ -56,0 +56,0 @@ });

{
"name": "larvitfiles",
"version": "3.0.0",
"version": "3.0.1",
"description": "Storage of files with an API and database to use in web environments",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc