Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@finn-no/cdn-uploader
Advanced tools
Small tool uploading assets to CDN backend (Google Cloud Storage)
Small tool uploading assets to CDN backend (Google Cloud Storage)
You must either specify key-filename or specify credentials which is a
base64 encoded JSON.stringify
version of the JSON based keyfile containing credentials
used when talking to Google Cloud Storage (GCS).
//base 64 encoded keyfile
const credentials = require('keyfile.json');
const credentialString = JSON.stringify(credentials);
return new Buffer(credentialString).toString('base64');
Install:
$ npm install cdn-uploader -g
Actual usage:
$ cdn-uploader /tmp/cdn-assets -a test-app
-- Uploaded assets --
test-app/example.jpg
test-app/css/SDFSDF.finn.css
test-app/js/SDFSDF.finn.js
Get help:
$ cdn-uploader -h
cdn-uploader [options] <assetsFolder>
Options:
--app-prefix, -a Application prefix used in the CDN url [string] [required]
--key-filename, -k JSON key file used to authenticate with Google Cloud
Platform.
If not set, the credentials option is used. [string]
--credentials, -c Stringified and base64 encoded version of the JSON key
file used to authenticate with Google Cloud Platform.
Can also be set as CDN_UPLOADER_CREDENTIALS environment
variable [string]
--bucket-name, -b Google Cloud Storage bucket to use.
[string] [default: "fiaas-assets"]
--project-id, -p Google Cloud Storage projectId.
[string] [default: "fiaas-gke"]
--cache-control Override the cache-control header for the assets
[string] [default: "public, max-age=2592000"]
--dry-run, -n Print a list of which files would be uploaded [boolean]
--help, -h, -? Show help [boolean]
--version, -v Show version number [boolean]
All options can also be set as environment variables, using the CDN_UPLOADER_
prefix.
E.g.: CDN_UPLOADER_APP_PREFIX
, CDN_UPLOADER_CREDENTIALS
, etc.
All files or folder beginning with a "." is automatically excluded (e.g. .gitignore
) and will not be uploaded.
You may also override other options if you like (handy for testing)
--key-filename
- JSON key file used to authenticate with GCP. If not set CDN_UPLOADER_CREDENTIALS environment variable is used.--bucket-name
- GCS bucket to use.--project-id
- GCS projectId.You can also use environment variables for these options, just use the prefix CDN_UPLOADER_
.
The files uploaded to GCS is made available on the public GCS hosting at:
https://storage.googleapis.com/<bucket-name>/<app-prefix>/<assetName>
This is again exposed by our CDN at:
https://static.finncdn.no/_c/<app-prefix>/<assetName>
All files uploaded to CDN is configured with Cache-Control: public, max-age=2592000
,
meaning all your assets will be cached in 30 days.
FAQs
Small tool uploading assets to CDN backend (Google Cloud Storage)
The npm package @finn-no/cdn-uploader receives a total of 15 weekly downloads. As such, @finn-no/cdn-uploader popularity was classified as not popular.
We found that @finn-no/cdn-uploader demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 12 open source maintainers collaborating on the project.
Did you know?
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.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.