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

cloudflare-sync

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cloudflare-sync - npm Package Compare versions

Comparing version 1.1.1 to 1.2.0

2

dist/package.json
{
"name": "cloudflare-sync",
"version": "1.1.1",
"version": "1.2.0",
"description": "CLI for uploading images to cloudflare.",

@@ -5,0 +5,0 @@ "bin": "dist/src/cli.js",

@@ -20,2 +20,3 @@ #!/usr/bin/env NODE_OPTIONS=--no-warnings node

.option("--ext <string>", "Comma-separated list of file extensions to process", "jpg,jpeg,png")
.option("--update", "Overwrite existing images on the server", false)
.action(sync);

@@ -25,3 +26,3 @@ async function sync(args) {

const { default: ora } = await import("ora");
const { source, account, parallel, resize, resizeFit } = args;
const { source, account, parallel, resize, resizeFit, update } = args;
if (source == null) {

@@ -61,3 +62,3 @@ throw new Error("Missing --source argument");

});
const filesToSync = srcFiles.filter((file) => file.serverData == null);
const filesToSync = srcFiles.filter((file) => file.serverData == null || update);
if (filesToSync.length === 0) {

@@ -88,3 +89,5 @@ spinner.stopAndPersist({

}
await client.uploadImage(file.relativePath, imageBuffer);
// It's an update if the serverData is present
const isUpdate = !!file.serverData;
await client.uploadImage(file.relativePath, imageBuffer, isUpdate);
completedCount++;

@@ -91,0 +94,0 @@ updateProgress();

@@ -32,3 +32,3 @@ export class CloudflareClient {

}
async uploadImage(pathname, content) {
async uploadImage(pathname, content, isUpdate) {
const formData = new FormData();

@@ -38,2 +38,7 @@ formData.append("file", new Blob([content]), pathname);

formData.append("id", pathname);
if (isUpdate) {
await this.callJSONAPI(`/images/v1/${encodeURIComponent(pathname)}`, {
method: "DELETE",
});
}
const result = await this.callJSONAPI("/images/v1", {

@@ -40,0 +45,0 @@ method: "POST",

{
"name": "cloudflare-sync",
"version": "1.1.1",
"version": "1.2.0",
"description": "CLI for uploading images to cloudflare.",

@@ -5,0 +5,0 @@ "bin": "dist/src/cli.js",

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