gcloud-node

Move/rename folder in Google Cloud Storage using nodejs gcloud api

廉价感情. 提交于 2020-08-19 07:06:21
问题 I am trying to rename or move a folder in google cloud storage using the gcloud api. A similar question explains how to delete a folder: Delete folder in Google Cloud Storage using nodejs gcloud api But how can one rename a folder? or move to another path? 回答1: You can try something like this: 'use strict' var async = require('async') var storage = require('@google-cloud/storage')() var bucket = storage.bucket('stephen-has-a-new-bucket') bucket.renameFolder = function(source, dest, callback)

Move/rename folder in Google Cloud Storage using nodejs gcloud api

China☆狼群 提交于 2020-08-19 07:05:31
问题 I am trying to rename or move a folder in google cloud storage using the gcloud api. A similar question explains how to delete a folder: Delete folder in Google Cloud Storage using nodejs gcloud api But how can one rename a folder? or move to another path? 回答1: You can try something like this: 'use strict' var async = require('async') var storage = require('@google-cloud/storage')() var bucket = storage.bucket('stephen-has-a-new-bucket') bucket.renameFolder = function(source, dest, callback)

How to reset emulator DB before each test?

折月煮酒 提交于 2020-08-08 05:25:48
问题 I'm running tests with the gcloud datastore emulator for node. I want to reset the db before each test. Is there a quick way like a 'drop' command or something I can use in a beforeEach block ? 回答1: Just simply remove the db file. Usually, it is ~/.config/gcloud/emulators/datastore/WEB-INF/appengine-generated/local_db.bin . 回答2: You could also send a POST /reset request to the emulator, mentioned here. 来源: https://stackoverflow.com/questions/39027941/how-to-reset-emulator-db-before-each-test

NodeJs Google Compute Engine Invalid ELF Header when using 'gcloud' module

青春壹個敷衍的年華 提交于 2020-02-05 07:53:05
问题 I am working on a project that requires me to use the gcloud nodejs module. I am testing this project locally using node app and locally on gcloud using gcloud preview app run app.yaml . When I have the following code in my file the project runs with node app but doesn't run with gcloud using gcloud preview app run app.yaml - I get the an invalid ELF Header error . var gcloud = require('gcloud'); I believe the project doesn't run with the gcloud command because it has something to do with me

Multiple select in google datastore query throwing ApiError: Precondition Failed error in node

丶灬走出姿态 提交于 2020-01-16 06:09:59
问题 I'm using following query to retrieve some entities from google Datastore: var query = datastore.createQuery(namespace,tableName); query.select(['displayName','username']); datastore.getEntitySet(query,function(err,data){ if(err){ res.status(500).end(); } else{ res.send(data); } }); The above code works fine if I select only one property i.e. query.select('username'); But with multiple select its throwing 412 'Precondition Failed' error. my entity looks like the following: Entity properties

Multiple select in google datastore query throwing ApiError: Precondition Failed error in node

只谈情不闲聊 提交于 2020-01-16 06:08:33
问题 I'm using following query to retrieve some entities from google Datastore: var query = datastore.createQuery(namespace,tableName); query.select(['displayName','username']); datastore.getEntitySet(query,function(err,data){ if(err){ res.status(500).end(); } else{ res.send(data); } }); The above code works fine if I select only one property i.e. query.select('username'); But with multiple select its throwing 412 'Precondition Failed' error. my entity looks like the following: Entity properties

Multiple select in google datastore query throwing ApiError: Precondition Failed error in node

我的未来我决定 提交于 2020-01-16 06:07:18
问题 I'm using following query to retrieve some entities from google Datastore: var query = datastore.createQuery(namespace,tableName); query.select(['displayName','username']); datastore.getEntitySet(query,function(err,data){ if(err){ res.status(500).end(); } else{ res.send(data); } }); The above code works fine if I select only one property i.e. query.select('username'); But with multiple select its throwing 412 'Precondition Failed' error. my entity looks like the following: Entity properties

not able to perform gcloud init inside dockerfile

吃可爱长大的小学妹 提交于 2020-01-12 07:31:48
问题 I have made a Dockerfile for deploying my node.js application into google container engine .It looks like as below FROM node:0.12 COPY google-cloud-sdk /google-cloud-sdk RUN /google-cloud-sdk/bin/gcloud init COPY bpe /bpe CMD cd /bpe;npm start I should use gcloud init inside Dockerfile because my node.js application is using gcloud-node module for creating buckets in GCS . When i am using the above dockerfile and doing docker built it is failing with following errors sudo docker build -t gcr