postinstall.js 476 B

12345678910111213141516171819
  1. const fs = require('fs');
  2. const path = require('path');
  3. const PublicFolder = path.resolve(__dirname, '..', 'public');
  4. const SourceFolder = path.dirname(require.resolve('streamsaver'));
  5. const DistFolder = path.resolve(PublicFolder, 'StreamSaver');
  6. if (!fs.existsSync(DistFolder)) {
  7. fs.mkdirSync(DistFolder);
  8. }
  9. function copyFile(name) {
  10. fs.copyFileSync(path.resolve(SourceFolder, name), path.resolve(DistFolder, name));
  11. }
  12. copyFile('mitm.html');
  13. copyFile('sw.js');