@dudadev/duda-migration-utils

1.0.0 • Public • Published

duda-migration-utils

Setup

npm install @dudadev/duda-migration-utils

API

getDomainUrl

Usage example:

const { getDomainUrl } = require('@dudadev/duda-migration-utils');

const domainUrl = await getDomainUrl(zipModifier);

addImages

Usage example:

const { addImages } = require('@dudadev/duda-migration-utils');

await zipModifier.modifyFiles(/\.html$/, async (content) => {
  const imagesRegex = /https\:\/\/.*?\.(jpg|png|jpeg|gif)/gi;
  const images = content.match(imagesRegex);

  return addImages(zipModifier, {
    content,
    images,
    baseUrl: 'https://my-domain.com'
  });
});

addNewFile

Usage example:

const { addNewFile } = require('@dudadev/duda-migration-utils');

const { body: content } = await fetch(imageUrl);
await addNewFile(zipModifier, {
  content,
  path: `images/${fileName}`,
  newTxtFields: { URL: imageUrl }
});

Readme

Keywords

none

Package Sidebar

Install

npm i @dudadev/duda-migration-utils

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

3.27 kB

Total Files

3

Last publish

Collaborators

  • dixiecarbonic
  • yoavporat
  • liady
  • russjeffery
  • idanen
  • hilakerer
  • sharon_rub
  • talkor
  • dannyr-duda
  • shira.weiss
  • roiekoper-duda
  • everett-duda