New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

google-cloud-bucket

Package Overview
Dependencies
Maintainers
1
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

google-cloud-bucket - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

10

CHANGELOG.md

@@ -5,2 +5,12 @@ # Change Log

<a name="0.1.2"></a>
## [0.1.2](https://github.com/nicolasdao/google-cloud-bucket/compare/v0.1.1...v0.1.2) (2018-11-25)
### Features
* Add support for custom headers ([51eb3b3](https://github.com/nicolasdao/google-cloud-bucket/commit/51eb3b3))
<a name="0.1.1"></a>

@@ -7,0 +17,0 @@ ## [0.1.1](https://github.com/nicolasdao/google-cloud-bucket/compare/v0.1.0...v0.1.1) (2018-11-21)

4

index.js

@@ -60,3 +60,3 @@ /**

const putObject = (object, filePath) => getToken(auth).then(token => gcp.insert(object, filePath, token))
const putObject = (object, filePath, options) => getToken(auth).then(token => gcp.insert(object, filePath, token, options))
const getObject = (bucket, filePath) => getToken(auth).then(token => gcp.get(bucket, filePath, token))

@@ -68,3 +68,3 @@ const makePublic = filePath => getToken(auth).then(token => {

const retryPutObject = (object, filePath, options={}) => _retryFn(() => putObject(object, filePath), options)
const retryPutObject = (object, filePath, options={}) => _retryFn(() => putObject(object, filePath, options), options)
.then(res => {

@@ -71,0 +71,0 @@ if (options.public)

{
"name": "google-cloud-bucket",
"version": "0.1.1",
"version": "0.1.2",
"description": "Nodejs package to add objects to a Google Cloud Bucket.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -9,4 +9,9 @@ /**

const { fetch, urlHelper } = require('./utils')
// Uploading data: https://cloud.google.com/storage/docs/json_api/v1/how-tos/upload
// Best practices: https://cloud.google.com/storage/docs/json_api/v1/how-tos/performance
// Object versioning: https://cloud.google.com/storage/docs/object-versioning
const { fetch, urlHelper, obj: { merge } } = require('./utils')
const BUCKET_UPLOAD_URL = (bucket, fileName) => `https://www.googleapis.com/upload/storage/v1/b/${encodeURIComponent(bucket)}/o?uploadType=media&name=${encodeURIComponent(fileName)}`

@@ -21,3 +26,3 @@ const BUCKET_URL = bucket => `https://www.googleapis.com/storage/v1/b/${encodeURIComponent(bucket)}`

const putObject = (object, filePath, token) => Promise.resolve(null).then(() => {
const putObject = (object, filePath, token, options={}) => Promise.resolve(null).then(() => {
_validateRequiredParams({ object, filePath, token })

@@ -29,7 +34,11 @@ const payload = typeof(object) == 'string' ? object : JSON.stringify(object || {})

return fetch.post(BUCKET_UPLOAD_URL(bucket, names.join('/')), {
'Content-Type': contentType || 'application/json',
let headers = merge(options.headers || {}, {
'Content-Length': payload.length,
Authorization: `Bearer ${token}`
}, payload)
})
if (!headers['Content-Type'])
headers['Content-Type'] = contentType || 'application/json'
return fetch.post(BUCKET_UPLOAD_URL(bucket, names.join('/')), headers, payload)
})

@@ -36,0 +45,0 @@

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