我看到一些示例,这些示例引用了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.
}

09-25 18:41