1
GetObject Mock gibt 0 Byte-Datei zurück. Meine Scheinvorstellung besteht darin, die komplette Datei zu bekommen.getObject Schein gibt 0 Byte-Datei zurück
Ich habe Code wie folgt:
AWSmock.mock("S3", "getObject", (params: any, callback: any) => {
try {
const filePath = path.join(__dirname, "../../seed/dummy_model/SampleNames.zip");
logger.debug("In mock S3.getObject()");
const data = readFileSync(filePath);
const stat = statSync(filePath);
logger.verbose(JSON.stringify(stat));
const props = {
Body: data,
ContentLength: data.length,
ETag: '"' + createHash("md5").update(data).digest("hex") + '"',
Key: params.Key,
LastModified: stat.mtime,
};
logger.verbose(JSON.stringify(props));
callback(null, props);
} catch (err) {
logger.error(err);
// process.exit(1);
callback(new Error("Unable to stream file."));
}
});
Ist das ein Problem mit der Bibliothek oder ich es falsch mache?
Bitte helfen Sie mir dabei. Danke im Voraus.
Dank Maneesh. Ich konnte es herausfinden, indem ich den Code las, verpasste es als Antwort. –