{"_id":"@btime/aws-s3","_rev":"6-cde2f3210d4786423864b8fdfe9185a3","name":"@btime/aws-s3","dist-tags":{"latest":"1.1.0"},"versions":{"1.0.0":{"name":"@btime/aws-s3","version":"1.0.0","description":"Aws S3 Package","main":"index.js","scripts":{"test":"mocha","coverage":"nyc --reporter=html mocha","prepush":"npm test"},"repository":{"type":"git","url":"git+ssh://git@github.com/Btime/btime-aws-s3-package.git"},"keywords":["btime","aws","s3","package","lib"],"author":{"name":"mundodehads"},"license":"MIT","bugs":{"url":"https://github.com/Btime/btime-aws-s3-package/issues"},"homepage":"https://github.com/Btime/btime-aws-s3-package#readme","dependencies":{"aws-sdk":"^2.212.1","joi":"^13.1.2","lodash":"^4.17.5","s3-url-exists":"^1.0.3"},"devDependencies":{"chai":"^4.1.2","dotenv":"^5.0.1","eslint":"^4.19.1","eslint-config-standard":"^11.0.0","eslint-plugin-import":"^2.9.0","eslint-plugin-mocha":"^4.12.1","eslint-plugin-node":"^6.0.1","eslint-plugin-promise":"^3.7.0","eslint-plugin-standard":"^3.0.1","husky":"^0.14.3","mocha":"^5.0.4","nyc":"^11.6.0"},"gitHead":"185baccb3ef2b1bcb9282c5bce772eecdc00b0d7","_id":"@btime/aws-s3@1.0.0","_npmVersion":"5.6.0","_nodeVersion":"8.9.0","_npmUser":{"name":"mundodehads","email":"omundodehads@gmail.com"},"dist":{"integrity":"sha512-qx2B1uyqc9AbUBY+zKHiuqSy3sa2vg7j7xW1qUzXxz+FxF+sJr723cpIJa423277iL7OCYAs1yuWO1MMGdLw5g==","shasum":"71e589534273e5721348940cc3e94c882b0bc937","tarball":"https://registry.npmjs.org/@btime/aws-s3/-/aws-s3-1.0.0.tgz","fileCount":14,"unpackedSize":493498,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDjQSnS+L3rmvlr+CIBDWKx+YPXzLS/YbotLn0a8W19HQIgMYar3tgoO5uDZmE6eOUJFv6rclBZGxMfGRqGHl+pvss="}]},"maintainers":[{"name":"mundodehads","email":"omundodehads@gmail.com"},{"name":"teambtime","email":"team@btime.com.br"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/aws-s3_1.0.0_1521831409429_0.7309349286497211"},"_hasShrinkwrap":false},"1.1.0":{"name":"@btime/aws-s3","version":"1.1.0","description":"Aws S3 Package","main":"index.js","scripts":{"test":"mocha","coverage":"nyc --reporter=html mocha","prepush":"npm test"},"repository":{"type":"git","url":"git+ssh://git@github.com/Btime/btime-aws-s3-package.git"},"keywords":["btime","aws","s3","package","lib"],"author":{"name":"mundodehads"},"license":"MIT","bugs":{"url":"https://github.com/Btime/btime-aws-s3-package/issues"},"homepage":"https://github.com/Btime/btime-aws-s3-package#readme","dependencies":{"aws-sdk":"^2.212.1","joi":"^13.1.2","lodash":"^4.17.5","s3-url-exists":"^1.0.3"},"devDependencies":{"chai":"^4.1.2","dotenv":"^5.0.1","eslint":"^4.19.1","eslint-config-standard":"^11.0.0","eslint-plugin-import":"^2.9.0","eslint-plugin-mocha":"^4.12.1","eslint-plugin-node":"^6.0.1","eslint-plugin-promise":"^3.7.0","eslint-plugin-standard":"^3.0.1","husky":"^0.14.3","mocha":"^5.0.4","nyc":"^11.6.0"},"gitHead":"76f01f43768f20af3260c328f3d7e245db997b12","_id":"@btime/aws-s3@1.1.0","_npmVersion":"5.6.0","_nodeVersion":"8.9.0","_npmUser":{"name":"mundodehads","email":"omundodehads@gmail.com"},"dist":{"integrity":"sha512-+UkHMV4D0DG1UF2G2HlXqJHcorXG2aZtBc2aq8xappS86+49pIGBocJ2xHWrXyGfNWqA2XszngBSpZDPrZPc5g==","shasum":"46ef0976819f2bed24699f2c730c13c946ba715e","tarball":"https://registry.npmjs.org/@btime/aws-s3/-/aws-s3-1.1.0.tgz","fileCount":14,"unpackedSize":493518,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCYzaLM69EfA8QQJmMFmCYtJstrPhsb5HHo7xd/pqgHSAIgCCS9DsLkmQn7womae/jQ3AR9paZvHxM6JXet4jbo80U="}]},"maintainers":[{"name":"mundodehads","email":"omundodehads@gmail.com"},{"name":"teambtime","email":"team@btime.com.br"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/aws-s3_1.1.0_1521832272768_0.06711385751071619"},"_hasShrinkwrap":false}},"time":{"created":"2018-03-23T18:56:49.381Z","1.0.0":"2018-03-23T18:56:49.652Z","modified":"2022-04-04T20:52:54.428Z","1.1.0":"2018-03-23T19:11:12.882Z"},"maintainers":[{"email":"guilhermecmaia.io@gmail.com","name":"guilherme.maia"},{"email":"amorim.dev@gmail.com","name":"vaynard"},{"email":"team@btime.com.br","name":"teambtime"}],"description":"Aws S3 Package","homepage":"https://github.com/Btime/btime-aws-s3-package#readme","keywords":["btime","aws","s3","package","lib"],"repository":{"type":"git","url":"git+ssh://git@github.com/Btime/btime-aws-s3-package.git"},"author":{"name":"mundodehads"},"bugs":{"url":"https://github.com/Btime/btime-aws-s3-package/issues"},"license":"MIT","readme":"# Btime AWS S3 Package\n\n![coverage](https://img.shields.io/badge/coverage-94.12%25-yellow.svg) ![node](https://img.shields.io/badge/node-v8.9.0-brightgreen.svg) ![npm](https://img.shields.io/badge/npm-v5.6.0-blue.svg)\n\n## AWS-S3\n\nThis package is an abstraction of the **AWS S3** `upload, select` and `deleteObject` actions.\n\n## Install with npm\n\n```bash\nnpm install @btime/aws-s3 --save\n```\n\n## Usage\n\nWhen requiring `aws-s3` package, you **must** have your `aws s3 credentials` to use as parameter like example below:\n\n```JS\nconst options = {\n  S3_REGION: 's3-region-here',\n  S3_KEY_SECRET: 's3-key-secret-here',\n  S3_KEY_ID: 's3-key-id-here',\n  S3_BUCKET: 's3-bucket-here'\n}\nconst S3 = require('@btime/aws-s3')(options)\n```\n\n**Note:** this is an example, we **recomend** you get options using `dotenv`, an example can be find in our Testing section.\n\nAws-s3 package returns an `AWS.S3()` instance along with `upload, select, deleteObject` functions that are Promisses, you can freely use AWS.S3 instance like you want, but our overwriten functions **should** be used like:\n\n### Upload\n\n```JS\nS3.upload(payload)\n  .then(response => {\n    /* HANDLE RESPONSE */\n  })\n  .catch(err => {\n    /* HANDLE ERROR */\n  })\n```\n\nPayload example:\n\n```JS\nconst payload = {\n  key: 'optionalKey',\n  file: 'requiredBuffer',\n  fileExtension: 'optionalExetension',\n  contentType: 'optionalMimeType'\n}\n```\n\nResponse example:\n\n```JS\n{\n  ETag: '\"123x321XX\"',\n  Location: 'https://s3-sa-east-1.amazonaws.com/bucket-test/keyExample',\n  Key: 'keyExample',\n  Bucket: 'bucket-test'\n}\n```\n\n### Select\n\n```JS\nconst payload = defineSelectPayload(params)\nS3.select(payload)\n  .then(response => {\n    /* HANDLE RESPONSE */\n  })\n  .catch(err => {\n    /* HANDLE ERROR */\n  })\n```\n\nPayload example:\n\n```JS\nconst payload = {\n  key: 'requiredKey'\n}\n```\n\nResponse example:\n\n```JS\n{ status: true, url: 'https://s3-sa-east-1.amazonaws.com/bucket-test/keyExample' }\n```\n\n### DeleteObject\n\n```JS\nconst payload = defineDeleteObjectPayload(params)\nS3.deleteObject(payload)\n  .then(response => {\n    /* HANDLE RESPONSE */\n  })\n  .catch(err => {\n    /* HANDLE ERROR */\n  })\n```\n\nPayload example:\n\n```JS\nconst payload = {\n  key: 'requiredKey'\n}\n```\n\nResponse example:\n\n```JS\n{ Key: 'keyExample' }\n```\n\n## Testing\n\nTests are coverage by Mocha and Chai, also, all inputs are validate by Joi.\n\n### Running\n\n1. Creating environment file\n\n```bash\ncp .env.dist .env\n```\n\n2. Edit environment file with your s3 credentials\n\n3. Running with npm\n\n```bash\nnpm test\n```\n\n**Optional:** Running test with coverage report using `Istanbul`:\n\n```bash\nnpm run coverage\n```\n","readmeFilename":"README.md"}