我看到一些示例,这些示例引用了GunDB S3存储驱动程序的一些参数,如下所示:
var Gun = require('gun');
var gun = Gun({
file: 'data.json',
s3: {
key: '', // AWS Access Key
secret: '', // AWS Secret Token
bucket: '' // The bucket you want to save into
}
});
我看不到参数来定义S3存储桶中的子目录/路径,以方便与非GunDB数据共享存储桶。有这样的选项/参数吗?
@hillct有一个名为的选项prefix
,感谢您指出这些选项没有记录。使用方法如下:
var Gun = require('gun');
var gun = Gun({
file: 'data.json',
s3: {
key: '', // AWS Access Key
secret: '', // AWS Secret Token
bucket: '', // The bucket you want to save into
prefix: 'gun/'
}
});
以防万一,这里还有一些其他选择:
{
throttle: 15 // Throttle writes to S3 in 15 second intervals, keeps S3 API costs down.
batch: 10 // Or if there are more than 10 things in queue, don't wait.
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句