Comparing version 1.0.0 to 1.0.1
@@ -75,11 +75,16 @@ //documentation:read a json file from s3 | ||
async get(key){ | ||
const getParams = getCmdParams(key); | ||
const cmd = new GetObjectCommand(getParams); | ||
const s3Resp = await s3Client.send(cmd); | ||
const s3Stream = s3Resp.Body; | ||
if(s3Stream instanceof Readable){ | ||
const data = await readStream(s3Stream); | ||
return data; | ||
}else{ | ||
throw new Error(`jstor s3: No readable stream found for ${key}`) ; | ||
try{ | ||
const getParams = getCmdParams(key); | ||
const cmd = new GetObjectCommand(getParams); | ||
const s3Resp = await s3Client.send(cmd); | ||
const s3Stream = s3Resp.Body; | ||
if(s3Stream instanceof Readable){ | ||
const data = await readStream(s3Stream); | ||
return data; | ||
}else{ | ||
throw new Error(`jstor s3: No readable stream found for ${key}`) ; | ||
} | ||
}catch(e){ | ||
//if a key does not exist S3 will return an error message... Where jstor will just indicate File.exists = false; | ||
return; | ||
} | ||
@@ -86,0 +91,0 @@ }, |
{ | ||
"name": "jstor-s3", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "jstor strategy for AWS S3", | ||
@@ -5,0 +5,0 @@ "main": "jstor-s3.js", |
9244
161