{"_id":"@coatilabs/keystone-image-manipulation-storage-adapter-s3","_rev":"3-f961093d4b3f6c6a704f5023732c21f0","name":"@coatilabs/keystone-image-manipulation-storage-adapter-s3","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@coatilabs/keystone-image-manipulation-storage-adapter-s3","version":"1.0.0","description":"S3 storage adapter for keystonejs with Jimp tool","main":"index.js","author":{"name":"coatilabs","email":"hola@coatilabs.com"},"license":"MIT","bugs":{"url":"https://github.com/coatilabs/keystone-storage-adapter-s3/issues"},"homepage":"https://github.com/coatilabs/keystone-storage-adapter-s3","dependencies":{"debug":"^2.2.0","jimp":"^0.2.28","keystone-storage-namefunctions":"^1.0.0","knox-s3":"^0.9.5","object-assign":"^4.1.0","sanitize-filename":"^1.6.1"},"devDependencies":{"dotenv":"^2.0.0","eslint":"^3.2.2","mocha":"^3.0.0"},"scripts":{"test":"eslint . && mocha test.js","lint":"eslint ."},"repository":{"type":"git","url":"git+https://github.com/coatilabs/keystone-storage-adapter-s3.git"},"keywords":["aws","keystone","keystone-storage","keystonejs","s3","storage"],"gitHead":"725bd99bc9f4b156b7d45943791919a1502bdfa4","_id":"@coatilabs/keystone-image-manipulation-storage-adapter-s3@1.0.0","_shasum":"93240c4e1dbde9ddc0d6b3954af9803c687fee62","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.12.2","_npmUser":{"name":"jupazave","email":"jupazave@gmail.com"},"dist":{"shasum":"93240c4e1dbde9ddc0d6b3954af9803c687fee62","tarball":"https://registry.npmjs.org/@coatilabs/keystone-image-manipulation-storage-adapter-s3/-/keystone-image-manipulation-storage-adapter-s3-1.0.0.tgz","fileCount":7,"unpackedSize":18945,"integrity":"sha512-Fqqdp0ozqoAJSyd5wNeoYS9UPZ80ImDXjrQhYi+GsJP7w3IYTZ3REAqrNsZCb7ki4hG1BDvViY/r3Evjw2t78Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAaJqcJYU0vjLmDTcKBg14+oM0iqE1+xKyC0kakdyFQ6AiBh+OgXhsN4K3ege2xcnu75j/LzK/K5oQ8jNvlbhYh91Q=="}]},"maintainers":[{"name":"jupazave","email":"jupazave@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/keystone-image-manipulation-storage-adapter-s3_1.0.0_1520801746607_0.062326348918729346"},"_hasShrinkwrap":false}},"time":{"created":"2018-03-11T20:55:46.506Z","1.0.0":"2018-03-11T20:55:46.675Z","modified":"2022-06-12T16:19:09.862Z"},"maintainers":[{"name":"jupazave","email":"jupazave@gmail.com"}],"description":"S3 storage adapter for keystonejs with Jimp tool","homepage":"https://github.com/coatilabs/keystone-storage-adapter-s3","keywords":["aws","keystone","keystone-storage","keystonejs","s3","storage"],"repository":{"type":"git","url":"git+https://github.com/coatilabs/keystone-storage-adapter-s3.git"},"author":{"name":"coatilabs","email":"hola@coatilabs.com"},"bugs":{"url":"https://github.com/coatilabs/keystone-storage-adapter-s3/issues"},"license":"MIT","readme":"# S3-based storage adapter for KeystoneJS with Jimp integration.\n\nThis adapter is designed to replace the existing `S3File` field in KeystoneJS using the new storage API, modified to  manipulate images after upload with [Jimp](https://github.com/oliver-moran/jimp) tool.\n\nTested in Node.js 6.12.2\n\n## Usage\n\nConfigure the storage adapter:\n\n```js\nvar storage = new keystone.Storage({\n  adapter: require('keystone-storage-adapter-s3'),\n  s3: {\n    key: 's3-key', // required; defaults to process.env.S3_KEY\n    secret: 'secret', // required; defaults to process.env.S3_SECRET\n    bucket: 'mybucket', // required; defaults to process.env.S3_BUCKET\n    region: 'ap-southeast-2', // optional; defaults to process.env.S3_REGION, or if that's not specified, us-east-1\n    path: '/profilepics',\n    headers: {\n      'x-amz-acl': 'public-read', // add default headers; see below for details\n    },\n    manageImage: function(file, callback) {\n      // Here you can manipulate file\n      callback(null, file);\n    }\n  },\n  schema: {\n    bucket: true, // optional; store the bucket the file was uploaded to in your db\n    etag: true, // optional; store the etag for the resource\n    path: true, // optional; store the path of the file in your db\n    url: true, // optional; generate & store a public URL\n  },\n});\n```\n\nThen use it as the storage provider for a File field:\n\n```js\nFile.add({\n  name: { type: String },\n  file: { type: Types.File, storage: storage },\n});\n```\n\n### Options:\n\nThe adapter requires an additional `s3` field added to the storage options. It accepts the following values:\n\n- **key**: *(required)* AWS access key. Configure your AWS credentials in the [IAM console](https://console.aws.amazon.com/iam/home?region=ap-southeast-2#home).\n\n- **secret**: *(required)* AWS access secret.\n\n- **bucket**: *(required)* S3 bucket to upload files to. Bucket must be created before it can be used. Configure your bucket through the AWS console [here](https://console.aws.amazon.com/s3/home?region=ap-southeast-2).\n\n- **region**: AWS region to connect to. AWS buckets are global, but local regions will let you upload and download files faster. Defaults to `'us-standard'`. Eg, `'us-west-2'`.\n\n- **path**: Storage path inside the bucket. By default uploaded files will be stored in the root of the bucket. You can override this by specifying a base path here. Base path must be absolute, for example '/images/profilepics'.\n\n- **headers**: Default headers to add when uploading files to S3. You can use these headers to configure lots of additional properties and store (small) extra data about the files in S3 itself. See [AWS documentation](http://docs.aws.amazon.com/AmazonS3/latest/API/RESTObjectPUT.html) for options. Examples: `{\"x-amz-acl\": \"public-read\"}` to override the bucket ACL and make all uploaded files globally readable.\n\n- **manageImage**: _(function; default: copies same file)_ Method to manipulate your image file\n  - See [`Jimp`](https://github.com/oliver-moran/jimp) for additional  documentation.\n\n### Schema\n\nThe S3 adapter supports all the standard Keystone file schema fields. It also supports storing the following values per-file:\n\n- **bucket**, **path**: The bucket, and path within the bucket, for the file can be is stored in the database. If these are present when reading or deleting files, they will be used instead of looking at the adapter configuration. The effect of this is that you can have some (eg, old) files in your collection stored in different bucket / different path inside your bucket.\n\nThe main use of this is to allow slow data migrations. If you *don't* store these values you can arguably migrate your data more easily - just move it all, then reconfigure and restart your server.\n\n- **etag**: The etag of the stored item. This is equal to the MD5 sum of the file content.\n\n\n# License\n\nLicensed under the standard MIT license. See [LICENSE](license).\n","readmeFilename":"README.md"}