-
Notifications
You must be signed in to change notification settings - Fork 598
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
need example of how to store unindexed,binary data in datastore #971
Comments
I think the answer is to use a Buffer which we'll then notice is a buffer, and set the value as the So the example would look like: var gcloud = require('gcloud')({ keyFilename: '/path/to/keyfile.json' });
var datastore = gcloud.datastore;
var dataset = datastore.dataset({projectId: 'your-dataset-id'});
var yourBuffer = new Buffer([0x0000, 0x0001, 0x0002]);
/* or you can set this to a file's contents:
var yourBuffer = fs.readFileSync('/path/to/yourfile');
*/
dataset.save({
key: dataset.key('YourKind'),
data: {
yourBlobProperty: yourBuffer
}, function(err) {
if (!err) {
console.log('Just saved', key.path);
}
}); |
Going to mark this as closed, but feel free to re-open if you think this is wrong. If you have an idea for how to improve the docs, feel free to open a PR. The examples for var key = dataset.key('Company');
dataset.save({
key: key,
data: {
name: 'DonutShack', // strings
rating: gcloud.datastore.int(8), // ints
worth: gcloud.datastore.double(123456.78), // doubles
numDonutsServed: 45, // detect number type (int or double)
founded: new Date('Tue May 12 2015 15:30:00 GMT-0400 (EDT)'), // dates
isStartup: true, // booleans
donutEmoji: new Buffer('\uD83C\uDF69'), // buffers
keywords: [ 'donut', 'coffee', 'yum' ] // lists of objects
}
}, function(err) {}); |
- [ ] Regenerate this pull request now. PiperOrigin-RevId: 470911839 Source-Link: googleapis/googleapis@3527566 Source-Link: googleapis/googleapis-gen@f16a1d2 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZjE2YTFkMjI0ZjAwYTYzMGVhNDNkNmE5YTFhMzFmNTY2ZjQ1Y2RlYSJ9 feat: accept google-gax instance as a parameter Please see the documentation of the client constructor for details. PiperOrigin-RevId: 470332808 Source-Link: googleapis/googleapis@d4a2367 Source-Link: googleapis/googleapis-gen@e97a1ac Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZTk3YTFhYzIwNGVhZDRmZTczNDFmOTFlNzJkYjdjNmFjNjAxNjM0MSJ9 fix: better support for fallback mode PiperOrigin-RevId: 468790263 Source-Link: googleapis/googleapis@873ab45 Source-Link: googleapis/googleapis-gen@cb6f37a Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiY2I2ZjM3YWVmZjJhMzQ3MmU0MGE3YmJhY2U4YzY3ZDc1ZTI0YmVlNSJ9 docs: updated some method comments and added an explicit note that DetectIntentRequest's text input is limited by 256 characters PiperOrigin-RevId: 463362184 Source-Link: googleapis/googleapis@1805fc2 Source-Link: googleapis/googleapis-gen@c47083a Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiYzQ3MDgzYTdiODI5Yzg1ZTM0MjMyNTBmN2NmNDMxZjA3MjM4YWQwNCJ9 docs: added an explicit note that DetectIntentRequest's text input is limited by 256 characters PiperOrigin-RevId: 463252698 Source-Link: googleapis/googleapis@eeacaab Source-Link: googleapis/googleapis-gen@da3bfa0 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiZGEzYmZhMDhiYTc3ZDE0YmE2NmU2ZWVlZTVhZDE1OWVmMzY1ZGYwZiJ9
- fix(deps): use google-gax v3.5.2 - fix: add comma
🤖 I have created a release *beep* *boop* --- ## [5.1.1](https://togithub.com/googleapis/nodejs-speech/compare/v5.1.0...v5.1.1) (2022-12-19) ### Bug Fixes * **deps:** Use google-gax v3.5.2 ([#971](https://togithub.com/googleapis/nodejs-speech/issues/971)) ([aca8d0c](https://togithub.com/googleapis/nodejs-speech/commit/aca8d0cbfba8cbfc3596959ca96a30020c7b2b40)) * Regenerated protos JS and TS definitions ([#975](https://togithub.com/googleapis/nodejs-speech/issues/975)) ([9087201](https://togithub.com/googleapis/nodejs-speech/commit/908720108ad9176488d1fd5851e9bd37f769b47f)) --- This PR was generated with [Release Please](https://togithub.com/googleapis/release-please). See [documentation](https://togithub.com/googleapis/release-please#release-please).
- fix(deps): use google-gax v3.5.2 - fix: add comma
🤖 I have created a release *beep* *boop* --- ## [5.1.1](https://togithub.com/googleapis/nodejs-speech/compare/v5.1.0...v5.1.1) (2022-12-19) ### Bug Fixes * **deps:** Use google-gax v3.5.2 ([#971](https://togithub.com/googleapis/nodejs-speech/issues/971)) ([aca8d0c](https://togithub.com/googleapis/nodejs-speech/commit/aca8d0cbfba8cbfc3596959ca96a30020c7b2b40)) * Regenerated protos JS and TS definitions ([#975](https://togithub.com/googleapis/nodejs-speech/issues/975)) ([9087201](https://togithub.com/googleapis/nodejs-speech/commit/908720108ad9176488d1fd5851e9bd37f769b47f)) --- This PR was generated with [Release Please](https://togithub.com/googleapis/release-please). See [documentation](https://togithub.com/googleapis/release-please#release-please).
Source-Link: googleapis/googleapis@7d0c6be Source-Link: googleapis/googleapis-gen@2ddc476 Copy-Tag: eyJwIjoicGFja2FnZXMvZ29vZ2xlLWNsb3VkLWNvbXB1dGUvLk93bEJvdC55YW1sIiwiaCI6IjJkZGM0NzZkNGNjZTZmMDdiNTFjYzY5NmZmYzNlMGM0Yzc2MWJiMTgifQ==
I can't figure out how to store an entity in datastore that has this field... Any idea? Any example would be great
filecontents: {blobValue: filecontents, indexed: false},
The text was updated successfully, but these errors were encountered: