{"_id":"dadu","_rev":"18-91ac9f53ee52313a41e458a34de72939","name":"dadu","description":"Drag and Drop Uploads","dist-tags":{"latest":"2.3.1"},"versions":{"1.0.2":{"name":"dadu","version":"1.0.2","description":"Drag and Drop Uploads","author":{"name":"Joe Hitchens","email":"joe@sleepless.com","url":"sleepless.com"},"license":{"type":"MIT","url":"https://github.com/sleeplessinc/dadu/raw/master/LICENSE"},"repositories":[{"type":"git","url":"https://sleeplessinc@github.com/sleeplessinc/dadu.git"}],"repository":{"type":"git","url":"git://github.com/sleeplessinc/dadu.git"},"_npmJsonOpts":{"file":"/Users/josephhitchens/.npm/dadu/1.0.2/package/package.json","wscript":false,"contributors":false,"serverjs":false},"_id":"dadu@1.0.2","dependencies":{},"devDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.0.22","_nodeVersion":"v0.4.10","_defaultsLoaded":true,"dist":{"shasum":"0e32d838ecba83daa66be3e1489b6fe97868fa36","tarball":"https://registry.npmjs.org/dadu/-/dadu-1.0.2.tgz","integrity":"sha512-HKU2eF/karMGvgQjKhF820SgexwPqtYptFYDaJ8wjGVDusbxUhaBfCtQAaO6g+xJczA8cPIlbA/hKsowt3e/Gg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCGMOL7Tl3bG5Mo5IxcWOhwE8JWOZEHhsS+EEJEr2TbwQIgN3UDohC6vnlADfwuTWHT3Ag3UN7TO6i2Te1CuX08Np0="}]},"scripts":{},"maintainers":[{"name":"sleeplessinc","email":"joe@sleepless.com"}]},"1.0.3":{"name":"dadu","version":"1.0.3","description":"Drag and Drop Uploads","author":{"name":"Joe Hitchens","email":"joe@sleepless.com","url":"sleepless.com"},"license":{"type":"MIT","url":"https://github.com/sleeplessinc/dadu/raw/master/LICENSE"},"repositories":[{"type":"git","url":"https://sleeplessinc@github.com/sleeplessinc/dadu.git"}],"repository":{"type":"git","url":"git://github.com/sleeplessinc/dadu.git"},"_npmUser":{"name":"sleeplessinc","email":"joe@sleepless.com"},"_id":"dadu@1.0.3","dependencies":{},"devDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.0.106","_nodeVersion":"v0.6.1","_defaultsLoaded":true,"dist":{"shasum":"3e6c095c8acbe1de36fc3e22b7772209be03b6c9","tarball":"https://registry.npmjs.org/dadu/-/dadu-1.0.3.tgz","integrity":"sha512-yIbqgFVcrIVRNt+gHe7lKx4aaTuoVyYmiM+HurqzIMkt1LgN8s9Ktp79a/Uas5+B74hAgpnSAMiHfXEcd4xYcA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC7UIso73qYKrRm2m2IoLPtL21G1LqhlkKhC1fv4lZv0AIhAMOPJND3Mk+CU/qG9Cy6oi8tm0ZesM9JXYg78ntMcHv3"}]},"maintainers":[{"name":"sleeplessinc","email":"joe@sleepless.com"}]},"1.0.4":{"name":"dadu","version":"1.0.4","description":"Drag and Drop Uploads","author":{"name":"Joe Hitchens","email":"joe@sleepless.com","url":"sleepless.com"},"license":{"type":"MIT","url":"https://github.com/sleeplessinc/dadu/raw/master/LICENSE"},"repositories":[{"type":"git","url":"https://sleeplessinc@github.com/sleeplessinc/dadu.git"}],"repository":{"type":"git","url":"git://github.com/sleeplessinc/dadu.git"},"_npmUser":{"name":"sleeplessinc","email":"joe@sleepless.com"},"_id":"dadu@1.0.4","dependencies":{},"devDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.0.106","_nodeVersion":"v0.6.1","_defaultsLoaded":true,"dist":{"shasum":"647d6ba1660f12a7f0cb8ddbf9f6815282f6912e","tarball":"https://registry.npmjs.org/dadu/-/dadu-1.0.4.tgz","integrity":"sha512-+WwJ0FE84zAjGH/8o2j3R2HTdfMx6yuKo/aUfPrQV7Mg5HTC7AgiFn8e9j+9NjHu3WIU4A0w/QDttjYU3zdRcw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC1iou2HOS3H6knSNw9x9X8VTU+WgJukfAU1r7jnf+KqAIgYvSfZad8NXXnx47OI8aa97zql8yWK9QpM6MJCopTNLM="}]},"maintainers":[{"name":"sleeplessinc","email":"joe@sleepless.com"}]},"1.0.5":{"name":"dadu","version":"1.0.5","description":"Drag and Drop Uploads","author":{"name":"Joe Hitchens","email":"joe@sleepless.com","url":"sleepless.com"},"license":{"type":"MIT","url":"https://github.com/sleeplessinc/dadu/raw/master/LICENSE"},"repositories":[{"type":"git","url":"https://sleeplessinc@github.com/sleeplessinc/dadu.git"}],"repository":{"type":"git","url":"git://github.com/sleeplessinc/dadu.git"},"_npmUser":{"name":"sleeplessinc","email":"joe@sleepless.com"},"_id":"dadu@1.0.5","dependencies":{},"devDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.0.106","_nodeVersion":"v0.6.1","_defaultsLoaded":true,"dist":{"shasum":"b2bbfe768b26bf19897c3c5d6c285d1b8812b079","tarball":"https://registry.npmjs.org/dadu/-/dadu-1.0.5.tgz","integrity":"sha512-haaJRNn8WqVxpEeZrA4nTpKns20cPHpWofU002tOg8uMxRqOjCQ/2k6W9aku5MTz0Q+OLU0pF8zMHLGuphZHww==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIB1fnsPNfgeQyQX8JNZtIZH9OB7RWXjI6w2FvcjpEy2hAiEAwHkHaCVNAy4HKD8w9dQK30ChZ9xMs5bqedhVEJpxw8k="}]},"maintainers":[{"name":"sleeplessinc","email":"joe@sleepless.com"}]},"1.1.0":{"name":"dadu","version":"1.1.0","description":"Drag and Drop Uploads","author":{"name":"Joe Hitchens","email":"joe@sleepless.com","url":"sleepless.com"},"license":{"type":"MIT","url":"https://github.com/sleeplessinc/dadu/raw/master/LICENSE"},"repository":{"type":"git","url":"git://github.com/sleeplessinc/dadu.git"},"dependencies":{"log5":"1.2.9","findit":"0.1.2","paperboy":"0.0.5"},"_npmUser":{"name":"sleeplessinc","email":"joe@sleepless.com"},"_id":"dadu@1.1.0","devDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.0.106","_nodeVersion":"v0.6.1","_defaultsLoaded":true,"dist":{"shasum":"bdb195aec973acdeba13f7fb33fdeacd3127798e","tarball":"https://registry.npmjs.org/dadu/-/dadu-1.1.0.tgz","integrity":"sha512-L0/yIPYqJrrtpOqSPgnF5tknmjn69NQXuxwEuC+CbfSgYbmOl2GC9qZyncXSj2f6eS3QWJzhVVejzucqdMK1CA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFBj9xuzYzyx9k8bKaOVNSw3l+tuFLzZdSbosguGFEnVAiEA/GTr5nPqZvjFst0kU2YDheMOxiua9zgJ8gLUtkWXdCw="}]},"maintainers":[{"name":"sleeplessinc","email":"joe@sleepless.com"}]},"2.1.0":{"name":"dadu","version":"2.1.0","description":"Drag and Drop Uploads","author":{"name":"Joe Hitchens","email":"joe@sleepless.com","url":"sleepless.com"},"license":{"type":"MIT","url":"https://github.com/sleeplessinc/dadu/raw/master/LICENSE"},"repository":{"type":"git","url":"git://github.com/sleeplessinc/dadu.git"},"dependencies":{},"readme":"\n# Drag and Drop Upload \n\nThis code module facilitates drag-and-drop file uploads in a web page.\n\nThere is a server component and a client (browser code) component.\n\n## Install\n\n\t$ npm install dadu\n\n## Server\n\n\t$ node dadu.js\n\n\n### Browser\n\n\nFirst create a Dadu object:\n\n\t<script src='dadu.js'></script>\n\t<script>\n\t\tvar dadu = new Dadu(\"http://yourserver.com:4080\");\n\t</script>\n\nAnd then call the target() function within the object with a DOM element:\n\n\t<div id=drop>\n\t\t[ Drop a file on me.]\n\t</div>\n\t<script>\n\t\tdadu.target(\n\t\t\tdocument.getElementById('drop'),\n\t\t\tcbStatus,\t\t// called every 1/4 second or so \n\t\t\tcbDragEnter,\t// called when mouse enters the target element.  \n\t\t\tcbDragExit,\t\t// called when mouse leaves the target element.  \n\t\t\tcbSent\t\t\t// called when upload is complete \n\t\t\t);\n\t</script>\n\nAt this point, you can now drag and drop files onto the target element\nto upload a file.\n\nThe sent() function receives an \"xfer\" object, which looks something like this:\n\n\t{\n\t\t\"error\":null,\n\t\t\"fileName\":\"foo.jpg\",\n\t\t\"size\":11100,\n\t\t\"type\":\"image/jpeg\",\n\t\t\"remoteName\":\"a7ac539156be4e5f8a74e5f8a72e08b_foo.jpg\",\n\t\t\"remoteSize\":11100\n\t}\n\nThe uploaded file will be in \"/tmp\" on the server machine and it will have the name\nindicated by \"remoteName\".\nThe remoteName may differ from the name of the file dropped into the browser.\n\nWhen this \"sent\" message is received, your own browser code then must\narrange for the file to be copied from \"/tmp\" on the server to its final location.\nThis must happen within 15 seconds, after which uploaded file is deleted from \"/tmp\".\n\nIf \"error\" is not null, then it will be a description of what went wrong.\nOtherwise, the upload succeeded.\n\nThe status() function receives an object that looks something like this:\n\n\t{\n\t\t\"queue\":[],\t\t// array of xfer objects waiting to be sent\n\t\t\"ok\":[],\t\t// array of xfer objects sent successfully\n\t\t\"error\":[],\t\t// array of xfer objects that experienced an error\n\t\t\"current\": {\t// the xfer object that is currently being uploaded (if any)\n\t\t\t\"fileName\":\"a7ac539156be4e5f8a74e5f8a72e08b_foo.jpg\",\n\t\t\t\"size\":11100,\n\t\t\t\"type\":\"image/jpeg\"\n\t\t\t\t\t\t// note that this is same object passed into sent() function, but\n\t\t\t\t\t\t// hasn't had remoteName and remoteSize added as it's not done yet.\n\t\t},\n\t\t\"filesTotal\":1,\t\t// num files to send\n\t\t\"filesDone\":0,\t\t// num sent OK\n\t\t\"filesFaild\":0,\t\t// num failed\n\t\t\"total\":11100,\t\t// bytes to send (all files)\n\t\t\"soFar\":0,\t\t\t// bytes sent so far (all files)\n\t\t\"percent\":0,\t\t// 0 - 100, indicating progress\n\t\t\"done\":false\t\t// true when all files processed and dadu goes idle\n\t}\n\n\n\n## Demo\n\nTo demonstrate, run the server in test mode:\n\n\t$ npm install dadu\n\t$ node dadu.js\n\nThen open \"http://yourserver:4080\" in a browser.\nYou will get a test page that you can drop files onto.\nThey will be uploaded and land in \"/tmp\", then vanish after 15 seconds.\n\n\n## License\n\nCopyright 2011 Sleepless Software Inc. All rights reserved.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to\ndeal in the Software without restriction, including without limitation the\nrights to use, copy, modify, merge, publish, distribute, sublicense, and/or\nsell copies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\nIN THE SOFTWARE. \n\n\n","readmeFilename":"README.md","_id":"dadu@2.1.0","dist":{"shasum":"b6c4239ae3f430e3452266c88aa37ca88ff9cfef","tarball":"https://registry.npmjs.org/dadu/-/dadu-2.1.0.tgz","integrity":"sha512-HhJ6Zuap1ndlHSHUIunEhdYdidagPQ364t6CTIUUlL+H1hRbRxlmOzKBIvDj0AwzVJDKEZintP8y0gOvYeM4NQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDG1cvVkl/2NGetVTU+kOSJvQjL3XA47BuqwfOsH203cgIgUOm5vJDJ1T7siEY2wHTpAHQFfWu8DfEfqVztTFyoM1U="}]},"_from":".","_npmVersion":"1.2.11","_npmUser":{"name":"sleeplessinc","email":"joe@sleepless.com"},"maintainers":[{"name":"sleeplessinc","email":"joe@sleepless.com"}]},"2.3.1":{"name":"dadu","version":"2.3.1","description":"Drag and Drop Uploads","author":{"name":"Joe Hitchens","email":"joe@sleepless.com","url":"sleepless.com"},"license":{"type":"MIT","url":"https://github.com/sleeplessinc/dadu/raw/master/LICENSE"},"repository":{"type":"git","url":"git://github.com/sleeplessinc/dadu.git"},"dependencies":{},"readme":"\n# Drag and Drop Upload \n\nThis module facilitates drag-and-drop file uploads in a web page.\n\nThere is a server component, a client (browser code) component, and a component\nthat you have to supply yourself.\n\nMultiple files can be dropped at once, and files additional files can be dropped\nwhile others are being transferred.  Dragging and dropping directories/folders\nis not supported.\n\n\n## Install\n\n\t$ npm install dadu\n\n## Server Component\n\n\t$ node dadu.js\n\nThe server listens on port 4080 and speaks HTTP.  It performs two jobs:\n\n1. It serves up its own browser code (GET /dadu.js) for use in HTML script tags.\n2. It receives uploads (POST /?file=filename) sent by said code.\n\nWhen the server receives a file, it is renamed to something unique, and stored in\n\"/tmp\" on the server.\n\n\n## Browser Component\n\nIn your web page, first create a Dadu object:\n\n\t<script src='dadu.js'></script>\n\t<script>\n\t\tvar dadu = new Dadu()\n\t</script>\n\nAnd then call the target() function within the object with a DOM element:\n\n\t<div id=drop> [ DROP FILES HERE ] </div>\n\t<script>\n\t\tdadu.target(\n\t\t\tdocument.getElementById('drop'),\n\t\t\tcbStatus,\t\t// called every 1/4 second or with status \n\t\t\tcbDragEnter,\t// called when mouse enters the target element.  \n\t\t\tcbDragExit,\t\t// called when mouse leaves the target element.  \n\t\t\tcbSent\t\t\t// called when upload is complete \n\t\t\t);\n\t</script>\n\nAt this point, you can now drag and drop files onto the target element\nto upload a file.\n\nWhen a file is successfully uploaded, \nthe \"cbSent\" function receives an object, that looks something like this:\n\n\t{\n\t\t\"error\":null,\n\t\t\"fileName\":\"foo.jpg\",\n\t\t\"size\":11100,\n\t\t\"type\":\"image/jpeg\",\n\t\t\"remoteName\":\"a7ac539356be4e5f8a74e5f8a72e08b_foo.jpg\",\n\t\t\"remoteSize\":11100\n\t}\n\nThe uploaded file will be found at\n\"/tmp/a7ac539356be4e5f8a74e5f8a72e08b_foo.jpg\"\non the server.\nNote that remoteName will differ from the name of the file dropped into the browser.\n\nIf \"error\" is not null, then it will be a description of what went wrong.\nOtherwise, the upload succeeded.\n\n\n## Your Component\n\nWhen the \"cbSent\" function is called with no error, it's now up to you to deal with\nit somehow, and you have to do so within 60 seconds. After that time, the uploaded\ncopy in \"/tmp\" is deleted.\n\nOne option is to for the browser to perform a XHR/Ajax call to a PHP script,\nsupplying it the \"remoteName\".  The PHP script can then copy the file from the\n\"/tmp\" dir to its final location.\n\nAnother option is for the dadu server to be instantiated manually and given a callback\nfunction.  That callback function can then do something with the uploaded file rather\nthan relying on the browser to call back to the server again.\nSee the \"Server: Advanced\" section below.\n\n\n\n## Demo\n\nTo demonstrate, run the server in test mode:\n\n\t$ npm install dadu\n\t$ node dadu.js\n\nThen open \"http://yourserver:4080\" in a browser.\nYou will get a test page that you can drop files onto.\nThey will be uploaded and land in \"/tmp\", then vanish after 60 seconds.\n\n\n## Server: Advanced\n\nNote that the server can also be instantiated manually by using dadu.js as a\nnode.js module:\n\n\tvar dadu = require( \"dadu\" );\n\tvar server = dadu.createServer().listen( my_port );\n\nIf you use a port other than 4080 here, you must ensure the browser code is doing so\nas well.\n\nThere are some options you can include as well, shown here with what are used\nas defaults if not provided:\n\n\tvar dadu = require( \"dadu\" );\n\tvar server = dadu.createServer({\n\t\tseq: 0,\t\t\t\t// incremented before each upload; participates in SHA1 hashing\n\t\trmSecs: 60,\t\t\t// seconds after upload that temp files are deleted\n\t\ttmpDir: \"/tmp\",\t\t// file system dir where uploaded files land\n\t\treClean: /[^-._a-z0-9]+/g,\t\t// used to clean up the names of uploaded files\n\t\tcleanRep: \"_\",\t\t// chars matching reClean in filename are replaced with this\n\t\tcbUpload: null,\t\t// called when a file is successfully uploaded:\n\t}).listen( my_port );\n\n\nThe cbUpload callback will receive 2 args:\n\n- error: null if no error, else string describing error\n- info: an object somehing like: { file: \"somefilename\", size: 12345 });\n\n\n## Browser Advanced\n\nThe status() function receives an object that looks something like this:\n\n\t{\n\t\t\"queue\":[],\t\t// array of xfer objects waiting to be sent\n\t\t\"ok\":[],\t\t// array of xfer objects sent successfully\n\t\t\"error\":[],\t\t// array of xfer objects that experienced an error\n\t\t\"current\": {\t// the xfer object that is currently being uploaded (if any)\n\t\t\t\"fileName\":\"a7ac539356be4e5f8a74e5f8a72e08b_foo.jpg\",\n\t\t\t\"size\":11100,\n\t\t\t\"type\":\"image/jpeg\"\n\t\t\t\t\t\t// note that this is same object passed into sent() function, but\n\t\t\t\t\t\t// hasn't had remoteName and remoteSize added as it's not done yet.\n\t\t},\n\t\t\"filesTotal\":1,\t\t// num files to send\n\t\t\"filesDone\":0,\t\t// num sent OK\n\t\t\"filesFaild\":0,\t\t// num failed\n\t\t\"total\":11100,\t\t// bytes to send (all files)\n\t\t\"soFar\":0,\t\t\t// bytes sent so far (all files)\n\t\t\"percent\":0,\t\t// 0 - 100, indicating progress\n\t\t\"done\":false\t\t// true when all files processed and dadu goes idle\n\t}\n\n\n\n\n## License\n\nCopyright 2011 Sleepless Software Inc. All rights reserved.\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to\ndeal in the Software without restriction, including without limitation the\nrights to use, copy, modify, merge, publish, distribute, sublicense, and/or\nsell copies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\nFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS\nIN THE SOFTWARE. \n\n\n","readmeFilename":"README.md","_id":"dadu@2.3.1","dist":{"shasum":"516cafb6bd174389572c55ba0d1264c20f54bd8e","tarball":"https://registry.npmjs.org/dadu/-/dadu-2.3.1.tgz","integrity":"sha512-o+FwSzVnZIlevk6RWDzlZZ/k9XLBk8LBLULdZzenDPC3AqPXvuQg5AlaqnqYrYyUOkDH+XufJneLLV66dxD+4g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC+ymBzIk6Dq6cvNQUSZqouzzzgFUjqN7hRb+3k/cng5gIhAPsc5XnQunUO9p6eP3Gb3vtv5qECTE7+yzj/i5EoEkn/"}]},"_from":".","_npmVersion":"1.2.11","_npmUser":{"name":"sleeplessinc","email":"joe@sleepless.com"},"maintainers":[{"name":"sleeplessinc","email":"joe@sleepless.com"}]}},"maintainers":[{"name":"sleeplessinc","email":"joe@sleepless.com"}],"time":{"modified":"2022-06-14T08:12:07.670Z","created":"2011-10-18T21:56:57.802Z","1.0.2":"2011-10-18T21:56:59.434Z","1.0.3":"2012-02-03T00:04:23.326Z","1.0.4":"2012-03-13T04:30:09.586Z","1.0.5":"2012-07-03T22:21:39.031Z","1.1.0":"2012-11-11T04:03:57.718Z","2.1.0":"2013-02-18T20:57:08.354Z","2.3.1":"2014-01-11T05:27:32.407Z"},"author":{"name":"Joe Hitchens","email":"joe@sleepless.com","url":"sleepless.com"},"repository":{"type":"git","url":"git://github.com/sleeplessinc/dadu.git"},"users":{"tunnckocore":true}}