@tryghost/mg-assetscraper v0.4.12
Migrate Assetscraper
Install
npm install @tryghost/mg-assetscraper --save
or
yarn add @tryghost/mg-assetscraper
Usage
// Default
const assetScraper = new AssetScraper(fileCache, {}, {
logger: myLogger
});
// Later on, create the Listr tasks
const tasks = ctx.imageScraper.fetch(ctx);
// Create the Listr task runner, ensuring its not concurrent:
// Each task *must* be run sequentially
const taskRunner = makeTaskRunner(tasks, {concurrent: false});
// And later still, run those tasks
await taskRunner.run();
// `ctx` is now updated
// Set some options
// 2 MB maximum, and no media files
const assetScraper = new AssetScraper(fileCache, {
sizeLimit: 2, // 2 MB
allowMedia: false,
baseDomain: 'https://example.com' // Set this domain to be added to relative asset links
}, {
logger: myLogger
});
// Don't scrape assets from this URL
assetScraper.addBlockedDomain('https://my-custom-cdn.example.com');
// Now create & run tasks
Develop
This is a mono repository, managed with lerna.
Follow the instructions for the top-level repo.
1. git clone
this repo & cd
into it as usual
2. Run yarn
to install top-level dependencies.
Run
yarn dev
Test
yarn lint
run just eslintyarn test
run lint and testsyarn benchmark
run benchmarks
Copyright & License
Copyright (c) 2013-2023 Ghost Foundation - Released under the MIT license.
10 days ago
2 months ago
3 months ago
4 months ago
5 months ago
5 months ago
7 months ago
7 months ago
6 months ago
10 months ago
10 months ago
8 months ago
9 months ago
11 months ago
1 year ago
12 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
1 year ago
2 years ago
2 years ago