
Research
Malicious fezbox npm Package Steals Browser Passwords from Cookies via Innovative QR Code Steganographic Technique
A malicious package uses a QR code as steganography in an innovative technique.
memoize-fs
Advanced tools
This project is inspired by the memoize project by Mariusz Nowak aka medikoo. The motivation behind this module is that sometimes you have to persist cached function calls but you do not want to deal with an extra process (ie. managing a Redis store). Memoization is best technique to save on memory or CPU cycles when we deal with repeated operations. For detailed insight see: http://en.wikipedia.org/wiki/Memoization
In your project path:
$ npm install memoize-fs
var memoize = require('memoize-fs')({ cachePath: require('path').join(__dirname, '../../build/cache' }),
fun = function (a, b) { return a + b; };
memoize.fn(fun).then(function (memFn) {
memFn(1, 2).then(function (result) {
assert.strictEqual(result, 3);
memFn(1, 2).then(function (result) { // cache hit
assert.strictEqual(result, 3);
}, function (err) { /* handle error */ });
}, function (err) { /* handle error */ });
}, function (err) { /* handle error */ });
Note that a result of a momoised function is always a Promise instance!
In order to memoize an async function it must be first promisified in the following manner:
Before:
var funAsync = function (a, b, cb) { setTimeout(function () { cb(null, a + b); }, 100); };
// later
funAsync(1, 2, function (err, result) {
if (err) throw err;
console.log(result);
});
After:
var funPromisified = function (a, b) {
return new require('es6-promise').Promise(function (resolve, reject) {
setTimeout(function () { resolve(a + b); }, 100);
});
};
// later
funPromisified(1, 2).then(function (result) {
console.log(result);
}, function (err) {
throw err;
});
// now we can memoize it
memoize.fn(funPromisified).then(...
####TODO: continue with docs here
FAQs
Node.js solution for memoizing/caching function results on the file system
The npm package memoize-fs receives a total of 5,961 weekly downloads. As such, memoize-fs popularity was classified as popular.
We found that memoize-fs demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.
Application Security
/Research
/Security News
Socket detected multiple compromised CrowdStrike npm packages, continuing the "Shai-Hulud" supply chain attack that has now impacted nearly 500 packages.