Yep, it is the same hash as if we had the full value. Here is an example:
If we had all the data upfront:
> crc32c(new Buffer('data1data2data3'))
772160458If we have to calculate bit-by-bit:
| GOOGLE_APPLICATION_CREDENTIALS=/Users/stephen/dev/key.json |
| diff --git a/system-test/storage.ts b/system-test/storage.ts | |
| index 15465b9..a096b65 100644 | |
| --- a/system-test/storage.ts | |
| +++ b/system-test/storage.ts | |
| @@ -111,6 +111,7 @@ describe('storage', () => { | |
| process.env.GOOGLE_APPLICATION_CREDENTIALS; | |
| delete process.env.GOOGLE_APPLICATION_CREDENTIALS; | |
| + delete require.cache[require.resolve('../src')]; | |
| const {Storage} = require('../src'); |
Yep, it is the same hash as if we had the full value. Here is an example:
If we had all the data upfront:
> crc32c(new Buffer('data1data2data3'))
772160458If we have to calculate bit-by-bit:
| function partialResultStream(requestFn, options) { | |
| var lastResumeToken; | |
| var activeRequestStream; | |
| options = extend({toJSON: false}, options); | |
| function makeRequest() { | |
| requestFn(lastResumeToken).pipe(userStream) | |
| } |
| 'use strict' | |
| const arrify = require('arrify') | |
| const log = require('kittie') | |
| const pubsub = require('./lib/pubsub')({ | |
| keyFilename: './keyfile.json' | |
| }) | |
| let count = 0; |
| Memory Usage: 21Mb | |
| Memory Usage: 32Mb | |
| Memory Usage: 28Mb | |
| Memory Usage: 25Mb | |
| Memory Usage: 23Mb | |
| Memory Usage: 36Mb | |
| Memory Usage: 33Mb | |
| Memory Usage: 31Mb | |
| Memory Usage: 28Mb |
| Memory Usage: 21Mb | |
| Memory Usage: 32Mb | |
| Memory Usage: 28Mb | |
| Memory Usage: 25Mb | |
| Memory Usage: 23Mb | |
| Memory Usage: 36Mb | |
| Memory Usage: 33Mb | |
| Memory Usage: 31Mb | |
| Memory Usage: 28Mb |
| export GCLOUD_TESTS_KEY='path/to/user-a-service-account-keyfile.json' | |
| export GCLOUD_TESTS_PROJECT_ID='user-a-project-id' | |
| export GCLOUD_TESTS_KEY_NON_WHITELIST='path/to/user-b-service-account-keyfile.json' | |
| export GCLOUD_TESTS_PROJECT_ID_NON_WHITELIST='user-b-project-id' | |
| git clone [email protected]:stephenplusplus/gcloud-node | |
| cd gcloud-node | |
| git checkout -b spp--2371 origin/spp--2371 | |
| cd packages/storage |
| var pumpify = require('pumpify') | |
| var through = require('through2') | |
| function makeGrpcStreamingRequest() { | |
| var transformStream = through.obj(function(obj, enc, next) { | |
| obj.transformed = true | |
| next(null, obj) | |
| }) | |
| var grpcRequestStream = through.obj() |
| /** | |
| * Copyright 2016 Google Inc. All Rights Reserved. | |
| * | |
| * Licensed under the Apache License, Version 2.0 (the "License"); | |
| * you may not use this file except in compliance with the License. | |
| * You may obtain a copy of the License at | |
| * | |
| * http://www.apache.org/licenses/LICENSE-2.0 | |
| * | |
| * Unless required by applicable law or agreed to in writing, software |