
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
blob-collections
Advanced tools
A collection of documents with BSON IDs (the kinds of IDs used by MongoDB), stored on top of a blobstore like S3. It's designed for tiny self-hosted apps.
BSON IDs (the kind of IDs used by MongoDB) include the dates and times, and
blob-collection
partitions the data in directories by date. It's optimized for
lookup of documents by time (think chat, email, or logs).
Documents can be listed with a before value and a limit. It will load up to limit documents before the before value, which can be a BSON ID or a date. It may not load all, but it will load at least one if one is available (subject to caching).
Documents have views for metadata, kind of like CouchDB, but much less powerful.
At present it only supports one view, and the view takes a version
which is
used for cache invalidation, a map
function which takes a document and returns
the data that will be merged with the _id
and the _etag
and returned by
list
, and a filter
function which can be used to keep documents from showing
up when listing data. The views, through caching, allow metadata to be returned
with a list of documents, without having to make a request for every key.
The view data is cached for each date partition, and it is saved to the file a given amount of time (default 120 seconds) after a document within a partition is updated. The metadata cache files are also used to find previous dates when paging through results. Document eTags are used in the metadata cache, along with the version of the view, so stale data will never be returned.
It's designed to prevent a lightly used app that has a lot of data in it from being expensive.
${isoDate}/${id}.json
manifest.json
views/${isoDate}.json
, adds the view data to it, and writes it.${isoDate}/${id}.json
and returns it${isoDate}/${id}.json
views/${isoDate}.json
, removes the document from
it, and writes itmanifest.json
indexes/${isoDate}.json
and views/${isoDate}.json
. If the view is
newer, lists the objects in the Blobstore to regenerate the index, and
writes it back. Reads the view data into memory.To create a collection, provide an S3 client, an S3 bucket, an optional prefix, and a view function which determines which data will be available in the index, as well as a view version to allow updates to the view function:
const client = require("./clients").S3Client;
const bucket = "my-nifty-blog";
const map = doc => {
const summary = doc.body.substring(0, 100);
return { title: doc.title, title: doc.author, summary };
};
const view = { map, version: "v1" };
const collection = new BlobCollection({
client,
bucket,
prefix: "posts",
view
});
Parameters:
new BlobCollection({...params})
params.client
: An S3 Client from aws-sdkparams.bucket
(string): The S3 bucketparams.prefix
(string): Optional. The prefix for the files. Example:
posts/
params.view
(viewParams
)
viewParams.map
(object => object
): Optional. This is called with the
document and returns an object that is used when creating the view.viewParams.filter
(object => boolean
): Optional. This is called with
the document and if it returns false, the document will be excluded when listing the data.viewParams.version
: Optional. The version that will be used when
storing and retrieving view documents. Provides the ability to update the
view without manually deleting the view documents and restarting the
servers.None yet.
MIT
FAQs
[![Build Status][build-status-image]][build-status]
We found that blob-collections demonstrated a not healthy version release cadence and project activity because the last version was released 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
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.