0.4.24 • Published 4 months ago

@tryghost/mg-assetscraper v0.4.24

Weekly downloads
-
License
MIT
Repository
-
Last release
4 months 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.24

4 months ago

0.4.23

4 months ago

0.4.22

5 months ago

0.4.21

5 months ago

0.4.20

6 months ago

0.4.19

6 months ago

0.4.18

9 months ago

0.4.17

10 months ago

0.4.16

11 months ago

0.4.15

12 months ago

0.4.14

1 year ago

0.4.13

1 year ago

0.4.12

1 year ago

0.4.11

1 year ago

0.4.10

1 year ago

0.4.9

2 years ago

0.4.8

2 years ago

0.4.7

2 years ago

0.4.5

2 years ago

0.4.4

2 years ago

0.4.6

2 years ago

0.4.1

2 years ago

0.4.0

2 years ago

0.4.3

2 years ago

0.4.2

2 years ago

0.3.11

2 years ago

0.3.9

2 years ago

0.3.10

2 years ago

0.3.6

2 years ago

0.3.5

2 years ago

0.3.8

2 years ago

0.3.7

2 years ago

0.3.4

2 years ago

0.3.3

2 years ago

0.3.2

2 years ago

0.3.0

2 years ago

0.3.1

2 years ago

0.2.15

2 years ago

0.2.14

3 years ago

0.2.13

3 years ago

0.2.12

3 years ago

0.2.11

3 years ago

0.2.10

3 years ago

0.2.1

3 years ago

0.2.0

3 years ago

0.2.7

3 years ago

0.2.6

3 years ago

0.2.9

3 years ago

0.2.8

3 years ago

0.2.3

3 years ago

0.2.2

3 years ago

0.2.5

3 years ago

0.2.4

3 years ago

0.1.1

3 years ago