
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.
@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 4 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
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.