
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
@pinelab/remote-asset-downloader
Advanced tools
Utility to download assets from remote servers and store locally for static site builds.
This util helps you download assets from a remote source to your local filesystem. We, at Pinelab, use it primarily to download transformed and optimized assets from Vendure and Directus for our static sites.
import { RemoteAssetDownloader } from '@pinelab/remote-asset-downloader';
const assetDownloader = new RemoteAssetDownloader({
publicAssetDirectory: './static/',
subDirectory: '/remote-img/',
getRemoteUrl: (assetId) =>
// This can be any asset server, as long as it returns an asset
`https://your-directus.io/assets/${assetId}`,
// Or process.env.NODE_ENV === 'production' to only download in production
downloadRemoteAsset: true,
});
// This example creates two new properties on a project: "project.featured_image.small"
// and "project.featured_image.medium"
for (const project of projects) {
const mediumImage = await asssetDownloader.getAsset(
project.featured_image.id,
{
// Download the preset `medium-webp` which is configure in Directus
fileName: `${project.title}_medium.webp`,
transformations: '?key=medium-webp',
}
);
project.featured_image.medium = mediumImage;
const smallImage = await asssetDownloader.getAsset(
project.featured_image.id,
{
fileName: `${project.title}_small.webp`,
transformations: '?key=small-webp',
}
);
project.featured_image.small = smallImage;
}
In the example above, you should exclude the subdirectory /remote-img/
from git. You might also want to add that same directory to the Netlify Build cache, so that assets won't be downloaded again for each build.
For use with Astro JS, you would use /public/
instead of /static/
:
const asssetDownloader = new RemoteAssetDownloader({
publicAssetDirectory: './public/',
subDirectory: '/remote-img/',
getRemoteUrl: (assetId) => `https://your-directus.io/assets/${assetId}`,
// Or process.env.NODE_ENV === 'production' to only download in production
downloadRemoteAsset: true,
});
FAQs
Utility to download assets from remote servers and store locally for static site builds.
The npm package @pinelab/remote-asset-downloader receives a total of 1 weekly downloads. As such, @pinelab/remote-asset-downloader popularity was classified as not popular.
We found that @pinelab/remote-asset-downloader 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.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
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.