0.4.12 • Published 10 days ago

@tryghost/mg-assetscraper v0.4.12

Weekly downloads
-
License
MIT
Repository
github
Last release
10 days ago

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 eslint
  • yarn test run lint and tests
  • yarn benchmark run benchmarks

Copyright & License

Copyright (c) 2013-2023 Ghost Foundation - Released under the MIT license.

0.4.12

10 days ago

0.4.11

2 months ago

0.4.10

3 months ago

0.4.9

4 months ago

0.4.8

5 months ago

0.4.7

5 months ago

0.4.5

7 months ago

0.4.4

7 months ago

0.4.6

6 months ago

0.4.1

10 months ago

0.4.0

10 months ago

0.4.3

8 months ago

0.4.2

9 months ago

0.3.11

11 months ago

0.3.9

1 year ago

0.3.10

12 months ago

0.3.6

1 year ago

0.3.5

1 year ago

0.3.8

1 year ago

0.3.7

1 year ago

0.3.4

1 year ago

0.3.3

1 year ago

0.3.2

1 year ago

0.3.0

1 year ago

0.3.1

1 year ago

0.2.15

1 year ago

0.2.14

1 year ago

0.2.13

1 year ago

0.2.12

1 year ago

0.2.11

1 year ago

0.2.10

1 year ago

0.2.1

2 years ago

0.2.0

2 years ago

0.2.7

1 year ago

0.2.6

1 year ago

0.2.9

1 year ago

0.2.8

1 year ago

0.2.3

2 years ago

0.2.2

2 years ago

0.2.5

1 year ago

0.2.4

2 years ago

0.1.1

2 years ago