{"_id":"mongoose-attachments","_rev":"26-15d05635b59b8f553f423c97b2f54af8","name":"mongoose-attachments","description":"Mongoose.js Attachments plugin. Supports ImageMagick styles","dist-tags":{"latest":"0.1.0"},"versions":{"0.0.1":{"author":{"name":"Firebase.co","email":"npm@firebase.co","url":"http://www.firebase.co/"},"name":"mongoose-attachments","description":"Mongoose.js Attachments plugin. Supports Amazon S3 and ImageMagick styles","version":"0.0.1","homepage":"https://github.com/firebaseco/mongoose-attachments","repository":{"type":"git","url":"git://github.com/firebaseco/mongoose-attachments.git"},"main":"index.js","scripts":{"test":"make test"},"dependencies":{"async":"0.1.x","knox":"0.0.x","imagemagick":"0.1.x"},"devDependencies":{},"optionalDependencies":{},"engines":{"node":"*"},"_npmUser":{"name":"firebaseco","email":"npm@firebase.co"},"_id":"mongoose-attachments@0.0.1","_engineSupported":true,"_npmVersion":"1.1.4","_nodeVersion":"v0.6.12","_defaultsLoaded":true,"dist":{"shasum":"82868769f0348075d63d42be5cf29e903ddaf29f","tarball":"https://registry.npmjs.org/mongoose-attachments/-/mongoose-attachments-0.0.1.tgz","integrity":"sha512-FVBL55vvTyjpkaQXl7/IL1bQvqTsQlgeLJPVGXTHky5XVqvl5pkkyeQ2cC8G0rruRGhWQ+VmyKvpfUOmDYtwMw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAisoSoY42rJkieS0UtSnQgdsqvrwRUVE2T2xsdwUNgNAiBfhj5tWraWs9/zyZVAA08W7/XN2Q65/KMiMRBYOBDmgQ=="}]},"maintainers":[{"name":"firebaseco","email":"npm@firebase.co"}],"directories":{}},"0.0.2":{"author":{"name":"Firebase.co","email":"npm@firebase.co","url":"http://www.firebase.co/"},"name":"mongoose-attachments","description":"Mongoose.js Attachments plugin. Supports Amazon S3 and ImageMagick styles","version":"0.0.2","homepage":"https://github.com/firebaseco/mongoose-attachments","repository":{"type":"git","url":"git://github.com/firebaseco/mongoose-attachments.git"},"main":"index.js","scripts":{"test":"make test"},"dependencies":{"async":"0.1.x","knox":"0.0.x","imagemagick":"0.1.x","aws2js":"0.6.x"},"devDependencies":{},"optionalDependencies":{},"engines":{"node":"*"},"_npmUser":{"name":"firebaseco","email":"npm@firebase.co"},"_id":"mongoose-attachments@0.0.2","_engineSupported":true,"_npmVersion":"1.1.21","_nodeVersion":"v0.6.18","_defaultsLoaded":true,"dist":{"shasum":"c9698cbad1b8ad4ad72988150ac825f9e0cfa546","tarball":"https://registry.npmjs.org/mongoose-attachments/-/mongoose-attachments-0.0.2.tgz","integrity":"sha512-XFQ+GhrbgVfcYGTw+o7fQZ3B/kOA33evr02QMzK95Ix/JXJnupgJTJ8ydm4Q8LZJ4WlB0QHkEAnpGGqx7egBYQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIChkILCx7GpFaN4lRmFW74MfMPdL18hRVUHV8z0Rj/OTAiEAtOWKl8Jp2lbvLCo3M0K+uMnvQtc9qZTTYAHxterAyXU="}]},"maintainers":[{"name":"firebaseco","email":"npm@firebase.co"}],"directories":{}},"0.0.3":{"author":{"name":"Firebase.co","email":"npm@firebase.co","url":"http://www.firebase.co/"},"name":"mongoose-attachments","description":"Mongoose.js Attachments plugin. Supports Amazon S3 and ImageMagick styles","version":"0.0.3","homepage":"https://github.com/firebaseco/mongoose-attachments","repository":{"type":"git","url":"git://github.com/firebaseco/mongoose-attachments.git"},"main":"index.js","scripts":{"test":"make test"},"dependencies":{"async":"0.1.x","knox":"0.0.x","imagemagick":"0.1.x","aws2js":"0.6.x"},"devDependencies":{},"optionalDependencies":{},"engines":{"node":"*"},"readme":"## What's mongoose-attachments?\n\nMongoose-Attachments is an attachments plugin for [Mongoose.js](http://mongoosejs.com/). Supports [Amazon S3](http://aws.amazon.com/es/s3/) out-of-the-box and ImageMagick transformations styles.\n\n### Installation\n\n    $ npm install mongoose-attachments\n\n### Usage\n\nThe following example extens the 'Post' model to use attachments with a property called 'image' and three different styles.\n\n    var mongoose = require('mongoose');\n    var attachments = require('mongoose-attachments');\n    var PostSchema = new mongoose.Schema({\n      title: String,\n      description: String\n    });\n    \n    PostSchema.plugin(attachments, {\n      directory: 'achievements',\n        storage: {\n          providerName: 's3',\n          options: {\n          key: '<key>',\n          secret: '<secret>',\n          bucket: '<bucket>'\n        }\n      },\n      properties: {\n        image: {\n          styles: {\n            original: {\n              // keep the original file\n            },\n            small: {\n              resize: '150x150'\n            },\n            medium: {\n              resize: '120x120'\n            },\n            medium_jpg: {\n              '$format': 'jpg' // this one changes the format of the image to jpg\n            }\n          }\n        }\n      }\n    });\n\t\n    var Post = mongoose.model('Post', PostSchema);\n\n#### Using with Express.js uploads\n\nAssuming that the HTML form sent a file in a field called 'image':\n\n    app.post('/upload', function(req, res, next) {\n      var post = new mongoose.model('Post')();\n      post.title = req.body.title;\n      post.description = req.body.description;\n      post.attach('image', req.files.image, function(err) {\t\n        if(err) return next(err);\n        post.save(function(err) {\n          if(err) return next(err);\n          res.send('Post has been saved with file!');\n        });\n      })\t\n    });\n\n#### Using with an stand-alone app files\n \n  \n    var post = new mongoose.model('Post')();\n    post.title = 'Title of the Post';\n    post.description = 'Description of the Post';\n    post.attach('image', {\n        path: '/path/to/the/file.png'\n      }, function(err) {\t\n        if(err) return next(err);\n        post.save(function(err) {\n          if(err) return next(err);\n          console.log('Post has been Saved with file');\n        });\n    })\t\n\n\n### Metadata\n\nWhen mongoose-attachments is used with images, it can provide basic information for each one of the specified styles:\n\nExample:\n\n\n    {\n      \"dims\" : {\n        \"w\" : 120,\n        \"h\" : 103\n      },\n      \"depth\" : 8,\n      \"format\" : \"PNG\",\n      \"oname\" : \"dragon.png\",\n      \"mtime\" : ISODate(\"2012-05-22T06:21:53Z\"),\n      \"ctime\" : ISODate(\"2012-05-22T06:21:53Z\"),\n      \"size\" : 26887,\n      \"path\" : \"/achievements/4fbaaa31db8cec0923000019-medium.png\",\n      \"defaultUrl\" : \"http://gamygame-dev.s3.amazonaws.com/achievements/4fbaaa31db8cec0923000019-medium.png\"\n    }\n\n### Styles and ImageMagick Transformations\n\nTransformations are achieved by invoking the **convert** command from ImageMagick and passing all the properties of the style as arguments.\n\nFor more information about convert, take a look at http://www.imagemagick.org/script/command-line-options.php\n\nExample in convert command:\n\n    convert source.png -resize '50%' output.png\n\nExample in plugin options:\n\n    styles: {\n      small: {\n        resize: '50%'\n      }\n    }\n\n#### Keeping the Original File\n\n    styles: {\n      original: {\n        // no transformations\n      }\n    }\n\n#### Multiples Transformations\n\nUse another properties under the style to provide more transformations\n\n    styles: {\n      small: {\n        crop: '120x120',\n        blur: '5x10' //radius x stigma\n      }\n    }\n\nMore information about 'blur' at the [ImageMagick website] http://www.imagemagick.org/script/command-line-options.php#blur\n\n#### Changing the Destination Format\n\nYou can change the destination format by using the special transformation '$format' with a known file extension like *png*, *jpg*, *gif*, etc.\n\nExample:\n\n    styles: {\n      as_jpeg: {\n        '$format': 'jpg'\n      }\n    }\n\nNote: **DO NOT** include the dot in the extension.\n\n### Contributors\n\n* [Johan Hernandez](https://github.com/thepumpkin1979)\n* [Chantal Ackermann](https://github.com/nuarhu)\n\n## License (MIT)\n\nCopyright (c) 2011 Firebase.co - http://firebase.co\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n","_id":"mongoose-attachments@0.0.3","dist":{"shasum":"528c60777da774e02c55fed861653fc81053680d","tarball":"https://registry.npmjs.org/mongoose-attachments/-/mongoose-attachments-0.0.3.tgz","integrity":"sha512-yHCMMfWR45q+51s+1hoJXpbVx40uniUO8TDPgMsRLmtrLP0kn+I4jc8HckboiElkWRdQWyLjNvrQshBPbxJ6Qg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIH8TjXjRjVQke1wSvySjoOHOkmMyaE6fi0xGT2jqfBzGAiBEIwNy1esd0RiPJXrtsQdaNaihCP1TNxbJ18Lcrk8rrg=="}]},"_npmVersion":"1.1.62","_npmUser":{"name":"firebaseco","email":"npm@firebase.co"},"maintainers":[{"name":"firebaseco","email":"npm@firebase.co"}],"directories":{}},"0.0.4":{"author":{"name":"Firebase.co","email":"npm@firebase.co","url":"http://www.firebase.co/"},"name":"mongoose-attachments","description":"Mongoose.js Attachments plugin. Supports Amazon S3 and ImageMagick styles","version":"0.0.4","homepage":"https://github.com/firebaseco/mongoose-attachments","repository":{"type":"git","url":"git://github.com/firebaseco/mongoose-attachments.git"},"main":"index.js","scripts":{"test":"make test"},"dependencies":{"async":"0.1.x","knox":"0.0.x","imagemagick":"0.1.x","aws2js":"0.6.x"},"devDependencies":{},"optionalDependencies":{},"engines":{"node":"*"},"_npmUser":{"name":"firebaseco","email":"npm@firebase.co"},"_id":"mongoose-attachments@0.0.4","_engineSupported":true,"_npmVersion":"1.1.21","_nodeVersion":"v0.6.18","_defaultsLoaded":true,"dist":{"shasum":"ea01dd9676ffe30ad3cc38418567acd766002be6","tarball":"https://registry.npmjs.org/mongoose-attachments/-/mongoose-attachments-0.0.4.tgz","integrity":"sha512-gI2NP6xQF1ui3Mi5GWLwqd+9x+tqiqvgdlpsLNNd1ATM75HMvaqZfytUN+LwbhbEd8gbc3f8eearI+4rkat9Dw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIG/Gb3emDkfEjo67A/s8atRld8OsisWUuwb5Dp0FjthZAiAgplYkwcIqDQpoIVxzIrnzwF57sF643GPCzvc6MphqNg=="}]},"maintainers":[{"name":"firebaseco","email":"npm@firebase.co"}],"directories":{}},"0.1.0":{"author":{"name":"Firebase.co","email":"npm@firebase.co","url":"http://www.firebase.co/"},"name":"mongoose-attachments","description":"Mongoose.js Attachments plugin. Supports ImageMagick styles","keywords":["mongoose","s3","imagemagick","uploads","attachments"],"version":"0.1.0","homepage":"https://github.com/firebaseco/mongoose-attachments","repository":{"type":"git","url":"git://github.com/firebaseco/mongoose-attachments.git"},"main":"index.js","scripts":{"test":"make test"},"dependencies":{"async":"0.1.x","imagemagick":"0.1.x"},"engines":{"node":"*"},"_npmUser":{"name":"firebaseco","email":"npm@firebase.co"},"_id":"mongoose-attachments@0.1.0","devDependencies":{},"optionalDependencies":{},"_engineSupported":true,"_npmVersion":"1.1.21","_nodeVersion":"v0.6.18","_defaultsLoaded":true,"dist":{"shasum":"920455166fbed5fc458c269540fa02082bcd37c0","tarball":"https://registry.npmjs.org/mongoose-attachments/-/mongoose-attachments-0.1.0.tgz","integrity":"sha512-/IbC/+uBygE+pOMPqSwwewRxo441ApPWfSYGMWEnYxQCqfFaYxvao8yqPD9jbVL1ADfEL5fD4DxiieB3Zh//Kw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDsH39J+9UPLynx7io69GizhaEN7NosRVw8CcJDyAs/3AiBQxkflK6M7nSdpAQi3DiifE2fbonpJFBttoBDUDuzmpg=="}]},"maintainers":[{"name":"firebaseco","email":"npm@firebase.co"}]}},"readme":"## What's mongoose-attachments?\n\nMongoose-Attachments is an attachments plugin for [Mongoose.js](http://mongoosejs.com/). Supports [Amazon S3](http://aws.amazon.com/es/s3/) out-of-the-box and ImageMagick transformations styles.\n\n### Installation\n\n    $ npm install mongoose-attachments\n\n### Usage\n\nThe following example extens the 'Post' model to use attachments with a property called 'image' and three different styles.\n\n    var mongoose = require('mongoose');\n    var attachments = require('mongoose-attachments');\n    var PostSchema = new mongoose.Schema({\n      title: String,\n      description: String\n    });\n    \n    PostSchema.plugin(attachments, {\n      directory: 'achievements',\n        storage: {\n          providerName: 's3',\n          options: {\n          key: '<key>',\n          secret: '<secret>',\n          bucket: '<bucket>'\n        }\n      },\n      properties: {\n        image: {\n          styles: {\n            original: {\n              // keep the original file\n            },\n            small: {\n              resize: '150x150'\n            },\n            medium: {\n              resize: '120x120'\n            },\n            medium_jpg: {\n              '$format': 'jpg' // this one changes the format of the image to jpg\n            }\n          }\n        }\n      }\n    });\n\t\n    var Post = mongoose.model('Post', PostSchema);\n\n#### Using with Express.js uploads\n\nAssuming that the HTML form sent a file in a field called 'image':\n\n    app.post('/upload', function(req, res, next) {\n      var post = new mongoose.model('Post')();\n      post.title = req.body.title;\n      post.description = req.body.description;\n      post.attach('image', req.files.image, function(err) {\t\n        if(err) return next(err);\n        post.save(function(err) {\n          if(err) return next(err);\n          res.send('Post has been saved with file!');\n        });\n      })\t\n    });\n\n#### Using with an stand-alone app files\n \n  \n    var post = new mongoose.model('Post')();\n    post.title = 'Title of the Post';\n    post.description = 'Description of the Post';\n    post.attach('image', {\n        path: '/path/to/the/file.png'\n      }, function(err) {\t\n        if(err) return next(err);\n        post.save(function(err) {\n          if(err) return next(err);\n          console.log('Post has been Saved with file');\n        });\n    })\t\n\n\n### Metadata\n\nWhen mongoose-attachments is used with images, it can provide basic information for each one of the specified styles:\n\nExample:\n\n\n    {\n      \"dims\" : {\n        \"w\" : 120,\n        \"h\" : 103\n      },\n      \"depth\" : 8,\n      \"format\" : \"PNG\",\n      \"oname\" : \"dragon.png\",\n      \"mtime\" : ISODate(\"2012-05-22T06:21:53Z\"),\n      \"ctime\" : ISODate(\"2012-05-22T06:21:53Z\"),\n      \"size\" : 26887,\n      \"path\" : \"/achievements/4fbaaa31db8cec0923000019-medium.png\",\n      \"defaultUrl\" : \"http://gamygame-dev.s3.amazonaws.com/achievements/4fbaaa31db8cec0923000019-medium.png\"\n    }\n\n### Styles and ImageMagick Transformations\n\nTransformations are achieved by invoking the **convert** command from ImageMagick and passing all the properties of the style as arguments.\n\nFor more information about convert, take a look at http://www.imagemagick.org/script/command-line-options.php\n\nExample in convert command:\n\n    convert source.png -resize '50%' output.png\n\nExample in plugin options:\n\n    styles: {\n      small: {\n        resize: '50%'\n      }\n    }\n\n#### Keeping the Original File\n\n    styles: {\n      original: {\n        // no transformations\n      }\n    }\n\n#### Multiples Transformations\n\nUse another properties under the style to provide more transformations\n\n    styles: {\n      small: {\n        crop: '120x120',\n        blur: '5x10' //radius x stigma\n      }\n    }\n\nMore information about 'blur' at the [ImageMagick website] http://www.imagemagick.org/script/command-line-options.php#blur\n\n#### Changing the Destination Format\n\nYou can change the destination format by using the special transformation '$format' with a known file extension like *png*, *jpg*, *gif*, etc.\n\nExample:\n\n    styles: {\n      as_jpeg: {\n        '$format': 'jpg'\n      }\n    }\n\nNote: **DO NOT** include the dot in the extension.\n\n## License (MIT)\n\nCopyright (c) 2011 Firebase.co - http://firebase.co\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n","maintainers":[{"name":"firebaseco","email":"npm@firebase.co"}],"time":{"modified":"2022-06-20T06:51:25.203Z","created":"2012-05-22T07:27:13.065Z","0.0.1":"2012-05-22T07:27:14.536Z","0.0.2":"2012-07-03T20:39:00.797Z","0.0.3":"2012-09-27T12:57:00.482Z","0.0.4":"2012-10-20T06:57:18.745Z","0.1.0":"2013-02-04T03:53:46.100Z"},"author":{"name":"Firebase.co","email":"npm@firebase.co","url":"http://www.firebase.co/"},"repository":{"type":"git","url":"git://github.com/firebaseco/mongoose-attachments.git"},"users":{"devonning":true,"voischev":true,"ahmetaygun":true}}