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

googleapis-common

Package Overview
Dependencies
Maintainers
1
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

googleapis-common - npm Package Compare versions

Comparing version 4.1.0 to 4.1.1-beta.0

96

build/src/apirequest.js

@@ -168,7 +168,59 @@ "use strict";

}
function multipartUpload(multipart) {
const boundary = uuid.v4();
const finale = `--${boundary}--`;
const rStream = new stream.PassThrough({
flush(callback) {
this.push('\r\n');
this.push(finale);
callback();
},
});
const pStream = new ProgressStream();
const isStream = isReadableStream(multipart[1].body);
headers['Content-Type'] = `multipart/related; boundary=${boundary}`;
for (const part of multipart) {
const preamble = `--${boundary}\r\nContent-Type: ${part['Content-Type']}\r\n\r\n`;
rStream.push(preamble);
if (typeof part.body === 'string') {
rStream.push(part.body);
rStream.push('\r\n');
}
else {
// Gaxios does not natively support onUploadProgress in node.js.
// Pipe through the pStream first to read the number of bytes read
// for the purpose of tracking progress.
pStream.on('progress', bytesRead => {
if (options.onUploadProgress) {
options.onUploadProgress({ bytesRead });
}
});
part.body.pipe(pStream).pipe(rStream);
}
}
if (!isStream) {
rStream.push(finale);
rStream.push(null);
}
options.data = rStream;
}
function browserMultipartUpload(multipart) {
const boundary = uuid.v4();
const finale = `--${boundary}--`;
headers['Content-Type'] = `multipart/related; boundary=${boundary}`;
let content = '';
for (const part of multipart) {
const preamble = `--${boundary}\r\nContent-Type: ${part['Content-Type']}\r\n\r\n`;
content += preamble;
if (typeof part.body === 'string') {
content += part.body;
content += '\r\n';
}
}
content += finale;
options.data = content;
}
if (parameters.mediaUrl && media.body) {
options.url = parameters.mediaUrl;
if (resource) {
// gaxios doesn't support multipart/related uploads, so it has to
// be implemented here.
params.uploadType = 'multipart';

@@ -182,38 +234,10 @@ const multipart = [

];
const boundary = uuid.v4();
const finale = `--${boundary}--`;
const rStream = new stream.PassThrough({
flush(callback) {
this.push('\r\n');
this.push(finale);
callback();
},
});
const pStream = new ProgressStream();
const isStream = isReadableStream(multipart[1].body);
headers['Content-Type'] = `multipart/related; boundary=${boundary}`;
for (const part of multipart) {
const preamble = `--${boundary}\r\nContent-Type: ${part['Content-Type']}\r\n\r\n`;
rStream.push(preamble);
if (typeof part.body === 'string') {
rStream.push(part.body);
rStream.push('\r\n');
}
else {
// Gaxios does not natively support onUploadProgress in node.js.
// Pipe through the pStream first to read the number of bytes read
// for the purpose of tracking progress.
pStream.on('progress', bytesRead => {
if (options.onUploadProgress) {
options.onUploadProgress({ bytesRead });
}
});
part.body.pipe(pStream).pipe(rStream);
}
if (!isbrowser_1.isBrowser()) {
// gaxios doesn't support multipart/related uploads, so it has to
// be implemented here.
multipartUpload(multipart);
}
if (!isStream) {
rStream.push(finale);
rStream.push(null);
else {
browserMultipartUpload(multipart);
}
options.data = rStream;
}

@@ -220,0 +244,0 @@ else {

{
"name": "googleapis-common",
"version": "4.1.0",
"version": "4.1.1-beta.0",
"description": "A common tooling library used by the googleapis npm module. You probably don't want to use this directly.",

@@ -27,3 +27,5 @@ "repository": "googleapis/nodejs-googleapis-common",

"predocs-test": "npm run docs",
"prelint": "cd samples; npm link ../; npm i"
"prelint": "cd samples; npm link ../; npm install",
"clean": "gts clean",
"precompile": "gts clean"
},

@@ -62,3 +64,3 @@ "keywords": [],

"karma-firefox-launcher": "^1.1.0",
"karma-mocha": "^1.3.0",
"karma-mocha": "^2.0.0",
"karma-remap-coverage": "^0.1.5",

@@ -72,6 +74,6 @@ "karma-sourcemap-loader": "^0.3.7",

"nock": "^12.0.0",
"null-loader": "^3.0.0",
"puppeteer": "^2.0.0",
"tmp": "^0.1.0",
"ts-loader": "^6.0.4",
"null-loader": "^4.0.0",
"puppeteer": "^3.0.0",
"tmp": "^0.2.0",
"ts-loader": "^7.0.0",
"typescript": "^3.8.3",

@@ -78,0 +80,0 @@ "webpack": "^4.35.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