如何将子目录路径传递给 GunDB S3 存储驱动程序,以便可以与非 Gun 数据共享同一个 S3 存储桶?

How do I pass a subdirectory path to the GunDB S3 storage driver so the same S3 bucket can be shared with non-Gun data?

我看到一些示例引用了 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 存储桶中定义 subdirectory/path 的参数,以方便与非 GunDB 数据共享存储桶。有这样的option/parameter吗?

@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.
}