这似乎是你的基本答案,但我仍然无法找到Node.js中的process.json文件及其作用,是否Node.js中存在任何文件?
我在这里讨论了stackoverflow上的一个问题,其中在安装npm模块时显示了process.json文件.
能否回答一下我真正有帮助的事情?
我想将GZip压缩的JSON文件上传到S3存储桶中,对此我很挣扎,有人可以帮我吗。这个。
以下是我在S3上上传Gzip压缩JSON文件的上传方法:
var uploadEntitlementDataOnS3 = function(next, event,
jsonFileContent, filePath, results) {
console.log("uploadEntitlementDataOnS3 function
started",jsonFileContent);
var bufferObject = new
Buffer.from(JSON.stringify(jsonFileContent));
var s3 = new AWS.S3();
var params = {
Bucket: configurationHolder.config.bucketName,
Key: filePath,
Body: bufferObject,
CacheControl: 'no-cache',
ContentType: "application/json",
ContentEncoding: 'gzip'
}
s3.putObject(params, function(err, data) {
if (err) {
console.log(err, err.stack);
next(err);
} else {
next(null, filePath);
}
});
};
Run Code Online (Sandbox Code Playgroud)
谢谢
我正在从 JSON 内容动态创建一个 CSV 文件,并在 S3 存储桶上上传生成的 CSV 文件,而不是首先将文件保存在本地。
下面是我的代码片段,因为使用下面的代码将我的 CSV 文件上传到 S3 存储桶,但它似乎不是正确的 CSV 格式。
var uploadCSVFileOnS3Bucket = function(next, csvFileContent,results) {
console.log("uploadCSVFileOnS3Bucket function started");
var bufferObject = new Buffer.from(JSON.stringify(csvFileContent));
var filePath = configurationHolder.config.s3UploadFilePath;
var s3 = new AWS.S3();
var params = {
Bucket: 'bucket_name'
Key: 's3UploadFilePath',
Body: bufferObject,
CacheControl:'public, max-age=86400'
}
s3.upload(params, function(err, data) {
if (err) {
console.log("Error at uploadCSVFileOnS3Bucket function",err);
next(err);
} else {
console.log("File uploaded Successfully");
next(null, filePath);
}
});
};
Run Code Online (Sandbox Code Playgroud)
另外,我正在使用“json2csv”npm 模块从 JSON 生成 csv …