Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

save-remote-file-webpack-plugin

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

save-remote-file-webpack-plugin

webpack 4 plugin to download & save remote files locally

  • 1.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

SaveRemoteFilePlugin webpack plugin

Installing

yarn add save-remote-file-webpack-plugin --dev

or

npm install save-remote-file-webpack-plugin --save-dev

How it works

webpack 4 plugin to download & save remote files locally

It was written to allow for the downloading of https://google-analytics.com/analytics.js so that it can be served locally, but it can be used to locally download any remote file as part of the webpack build process.

The resulting file has a content hash appended to the file name after it is downloaded, and is added to your manifest.json if you are using manifest-webpack-plugin

Usage

const SaveRemoteFilePlugin = require('save-remote-file-webpack-plugin');
module.exports = {
    plugins: [
        new SaveRemoteFilePlugin([
            {
                url: 'https://google-analytics.com/analytics.js',
                filepath: 'js/analytics.js',
            },
        ])
    ]
}

This would emit js/analytics.45eff9ff7d6c7c1e3c3d4184fdbbed90.js and in your manifest.json something like this:

  "js/analytics.js": "/dist/js/analytics.45eff9ff7d6c7c1e3c3d4184fdbbed90.js"

Options

You can pass in either an object, or an array of objects for downloading multiple files.

  • url - remote URL of the remote file to save locally
  • filepath - filename where the file will be saved, relative to your webpack output.path
  • hash - [boolean] whether to add a content hash to the output filename. (default: true)

FAQs

Package last updated on 23 Apr 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc