├── .eslintrc.json ├── .gitignore ├── LICENSE ├── README.md ├── bin ├── lame ├── sox └── soxi ├── index.js ├── lib ├── lambda-audio.js └── spawn.js ├── package-lock.json ├── package.json └── spec ├── files └── rain.mp3 ├── lambda-audio-spec.js └── support ├── jasmine-runner.js └── jasmine.json /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "defaults", 3 | "env": { 4 | "node": true, 5 | "es6": true 6 | }, 7 | "parserOptions": { 8 | "ecmaVersion": 6, 9 | "sourceType": "module" 10 | }, 11 | "rules": { 12 | "no-console": "off", 13 | "semi": ["error", "never"], 14 | "indent": ["error", 2], 15 | "quotes": ["error", "single", {"avoidEscape": true, "allowTemplateLiterals": true}], 16 | "prefer-arrow-callback": "error" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | .DS_Store 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | , 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. 340 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SoX for AWS Lambda 2 | 3 | Run Sound eXchange (SoX), the Swiss Army knife of audio manipulation, with Lame on AWS Lambda. 4 | 5 | ## What 6 | 7 | `lambda-audio` is static binary of [sox](http://sox.sourceforge.net) utility, built for AWS Lambda. It supports `sox`, `soxi` and `lame` commands. 8 | 9 | ## Why 10 | 11 | `lambda-audio` allows you to covert and merge multiple audio files using AWS Lambda. 12 | 13 | You can use it as a replacement/cheaper version of [Amazon Elastic Transcoder](https://aws.amazon.com/elastictranscoder/). Or you can use it for the workflows that are not currently possible on Elastic Transcoder. 14 | 15 | Motivation behind this library was a use case where we had up to five audio file that needs to be merged with specific rules — we need to put music in the background and different pauses between voice files. Service is used only from time to time, but we had instance for node.js app running all the time. This library is trying to solve that problem and allow us to do merging and conversion in AWS Lambda. 16 | 17 | ## How 18 | 19 | ### Installation 20 | 21 | You can install this package from NPM by running following command: 22 | 23 | ```shell 24 | npm install lambda-audio --save 25 | ``` 26 | 27 | ### Usage 28 | 29 | After you require node module in your code by adding: 30 | 31 | ```javascript 32 | const lambdaAudio = require('lambda-audio') 33 | ``` 34 | 35 | `lambdaAudio` will contain three functions: 36 | 37 | - sox 38 | - soxi 39 | - lame 40 | 41 | Each of the functions receives 1 argument that can be the string that contains the command or an array of attributes that needs to be passed to the command. 42 | 43 | Each function is returning promise that will resolve when the command is successfully executed or has an error. Success answers will go to `.then` statement, errors will go to `.catch` statement. Response for both success and error will be passed as a string argument. 44 | 45 | See below for the examples. 46 | 47 | #### sox command 48 | 49 | Let's say that you want to convert input.mp3 file to mono, and output it as output.wav file, in command line you would do that like this: 50 | 51 | ```shell 52 | sox input.mp3 -c 1 output.wav 53 | ``` 54 | 55 | With `lambda-audio` you can do that by passing the command as a string, just without `sox` part, like this: 56 | 57 | ```javascript 58 | lambdaAudio.sox('./input.mp3 -c 1 /tmp/output.wav') 59 | .then(response => { 60 | // Do something when the file was converted 61 | }) 62 | .catch(errorResponse => { 63 | console.log('Error from the sox command:', errorResponse) 64 | }) 65 | ``` 66 | 67 | Or by passing the arguments as an array: 68 | 69 | ```javascript 70 | lambdaAudio.sox(['./input.mp3', '-c', '1', '/tmp/output.wav']) 71 | .then(response => { 72 | // Do something when the file was converted 73 | }) 74 | .catch(errorResponse => { 75 | console.log('Error from the sox command:', errorResponse) 76 | }) 77 | ``` 78 | 79 | Keep in mind that AWS Lambda is read only and that the output path needs to be in /tmp folder. 80 | 81 | For the full list of options, visit [sox documentation](http://sox.sourceforge.net/soxformat.html). 82 | 83 | #### soxi command 84 | 85 | Let's say that you want to see the info about input.mp3 file, in command line you would do that like this: 86 | 87 | ```shell 88 | soxi input.mp3 89 | ``` 90 | 91 | With `lambda-audio` you can do that by passing the command as a string: 92 | 93 | ```javascript 94 | lambdaAudio.soxi('./input.mp3') 95 | .then(response => { 96 | // Do something with the info 97 | }) 98 | .catch(errorResponse => { 99 | console.log('Error from the soxi command:', errorResponse) 100 | }) 101 | ``` 102 | 103 | Or by passing the arguments as an array: 104 | 105 | ```javascript 106 | lambdaAudio.soxi(['./input.mp3']) 107 | .then(response => { 108 | // Do something with the info 109 | }) 110 | .catch(errorResponse => { 111 | console.log('Error from the soxi command:', errorResponse) 112 | }) 113 | ``` 114 | 115 | For the full list of options, visit [soxi documentation](http://sox.sourceforge.net/soxi.html). 116 | 117 | #### lame command 118 | 119 | Let's say you want to re-encode existing MP3 to 64 kbps MP3, in command line you would do it like this: 120 | 121 | ```shell 122 | lame -b 64 input.mp3 output.mp3 123 | ``` 124 | 125 | With `lambda-audio` you can do that by passing the command as a string: 126 | 127 | ```javascript 128 | lambdaAudio.lame('-b 64 ./input.mp3 /tmp/output.mp3') 129 | .then(response => { 130 | // Do something with the new mp3 file 131 | }) 132 | .catch(errorResponse => { 133 | console.log('Error from the lame command:', errorResponse) 134 | }) 135 | ``` 136 | 137 | Or by passing the arguments as an array: 138 | 139 | ```javascript 140 | lambdaAudio.lame(['-b', '64', './input.mp3', '/tmp/output.mp3']) 141 | .then(response => { 142 | // Do something with the new mp3 file 143 | }) 144 | .catch(errorResponse => { 145 | console.log('Error from the lame command:', errorResponse) 146 | }) 147 | ``` 148 | 149 | For the full list of options, visit [lame documentation](http://lame.cvs.sourceforge.net/viewvc/lame/lame/USAGE). 150 | 151 | ### Deployment 152 | 153 | `lambda-audio` is working perfectly with [Claudia.js](https://claudiajs.com) library, but you can use it with other AWS Libraries and frameworks too. 154 | 155 | With Claudia.js, simply save `lambda-audio` as a dependency and then you can deploy your AWS Lambda function using standard `claudia create` command. 156 | 157 | ### Testing 158 | 159 | We use [Jasmine](https://jasmine.github.io/) for unit and integration tests. Unless there is a very compelling reason to use something different, please continue using Jasmine for tests. The existing tests are in the [spec](spec) folder. Here are some useful command shortcuts: 160 | 161 | Run all the tests: 162 | 163 | ```bash 164 | npm test 165 | ``` 166 | 167 | Run only some tests: 168 | 169 | ```bash 170 | npm test -- filter=prefix 171 | ``` 172 | 173 | Get detailed hierarchical test name reporting: 174 | 175 | ```bash 176 | npm test -- full 177 | ``` 178 | 179 | ## License 180 | 181 | GNU GENERAL PUBLIC LICENSE, Version 2 -- see [LICENSE](LICENSE) 182 | -------------------------------------------------------------------------------- /bin/lame: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stojanovic/lambda-audio/c964a63a168502fee8a4277877b4928bcdd45ac6/bin/lame -------------------------------------------------------------------------------- /bin/sox: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stojanovic/lambda-audio/c964a63a168502fee8a4277877b4928bcdd45ac6/bin/sox -------------------------------------------------------------------------------- /bin/soxi: -------------------------------------------------------------------------------- 1 | ./bin/sox -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | const lambdaAudio = require('./lib/lambda-audio') 2 | 3 | module.exports = lambdaAudio 4 | -------------------------------------------------------------------------------- /lib/lambda-audio.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | const spawn = require('./spawn') 4 | const fs = require('fs') 5 | const path = require('path') 6 | 7 | function invokeCommand(command, args) { 8 | if (Array.isArray(args) || typeof args === 'string') 9 | return spawn(command, typeof args === 'string' ? args.split(' ') : args) 10 | 11 | throw new Error('Arguments need to be passed as a string or an array') 12 | } 13 | 14 | function sox(options) { 15 | const command = process.env.NODE_ENV === 'test' ? (process.env.SOX_PATH || 'sox') : path.join(__dirname, '../bin/sox') 16 | 17 | return invokeCommand(command, options) 18 | } 19 | 20 | function soxi(options) { 21 | const soxiPath = path.join(__dirname, '../bin/soxi') 22 | // If soxi symlink is uploaded us it 23 | const lambdaSoxiPath = fs.existsSync(soxiPath) ? soxiPath : '/tmp/soxi' 24 | 25 | if (process.env.NODE_ENV !== 'test' && lambdaSoxiPath === '/tmp/soxi' && !fs.existsSync(lambdaSoxiPath)) 26 | // Current version of Claudia.js is not uploading symlinks, and soxi is simply a symlink to sox, 27 | // so we need to check if soxi is already present in /tmp and create symlink if it's not 28 | fs.symlinkSync(path.join(__dirname, '../bin/sox'), '/tmp/soxi') 29 | 30 | const command = process.env.NODE_ENV === 'test' ? (process.env.SOXI_PATH || 'soxi') : lambdaSoxiPath 31 | 32 | return invokeCommand(command, options) 33 | } 34 | 35 | function lame(options) { 36 | const command = process.env.NODE_ENV === 'test' ? (process.env.LAME_PATH || 'lame') : path.join(__dirname, '../bin/lame') 37 | 38 | return invokeCommand(command, options) 39 | } 40 | 41 | module.exports = { 42 | sox: sox, 43 | soxi: soxi, 44 | lame: lame 45 | } 46 | -------------------------------------------------------------------------------- /lib/spawn.js: -------------------------------------------------------------------------------- 1 | 'use strict' 2 | 3 | const childProcess = require('child_process') 4 | 5 | function spawnPromise(command, commandArgs, options) { 6 | return new Promise((resolve, reject) => { 7 | const process = childProcess.spawn(command, commandArgs, options) 8 | const log = [] 9 | 10 | process.stdout.on('data', buffer => log.push(buffer.toString())) 11 | 12 | process.stderr.on('data', buffer => log.push(buffer.toString())) 13 | 14 | process.on('close', code => { 15 | if (code !== 0) { 16 | if (log.length) { 17 | return reject(log.join('\n')) 18 | } 19 | 20 | return reject(code) 21 | } 22 | 23 | if (log.length) 24 | return resolve(log.join('\n')) 25 | 26 | resolve() 27 | }) 28 | }) 29 | } 30 | 31 | module.exports = spawnPromise 32 | -------------------------------------------------------------------------------- /package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "lambda-sox", 3 | "version": "1.0.0", 4 | "lockfileVersion": 1, 5 | "dependencies": { 6 | "acorn": { 7 | "version": "5.1.1", 8 | "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.1.1.tgz", 9 | "integrity": "sha512-vOk6uEMctu0vQrvuSqFdJyqj1Q0S5VTDL79qtjo+DhRr+1mmaD+tluFSCZqhvi/JUhXSzoZN2BhtstaPEeE8cw==", 10 | "dev": true 11 | }, 12 | "acorn-jsx": { 13 | "version": "3.0.1", 14 | "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-3.0.1.tgz", 15 | "integrity": "sha1-r9+UiPsezvyDSPb7IvRk4ypYs2s=", 16 | "dev": true, 17 | "dependencies": { 18 | "acorn": { 19 | "version": "3.3.0", 20 | "resolved": "https://registry.npmjs.org/acorn/-/acorn-3.3.0.tgz", 21 | "integrity": "sha1-ReN/s56No/JbruP/U2niu18iAXo=", 22 | "dev": true 23 | } 24 | } 25 | }, 26 | "ajv-keywords": { 27 | "version": "1.5.1", 28 | "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-1.5.1.tgz", 29 | "integrity": "sha1-MU3QpLM2j609/NxU7eYXG4htrzw=", 30 | "dev": true 31 | }, 32 | "ansi-regex": { 33 | "version": "2.1.1", 34 | "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", 35 | "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", 36 | "dev": true 37 | }, 38 | "ansi-styles": { 39 | "version": "2.2.1", 40 | "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", 41 | "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", 42 | "dev": true 43 | }, 44 | "argparse": { 45 | "version": "1.0.9", 46 | "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.9.tgz", 47 | "integrity": "sha1-c9g7wmP4bpf4zE9rrhsOkKfSLIY=", 48 | "dev": true 49 | }, 50 | "array-union": { 51 | "version": "1.0.2", 52 | "resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz", 53 | "integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=", 54 | "dev": true 55 | }, 56 | "array-uniq": { 57 | "version": "1.0.3", 58 | "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz", 59 | "integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=", 60 | "dev": true 61 | }, 62 | "arrify": { 63 | "version": "1.0.1", 64 | "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", 65 | "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", 66 | "dev": true 67 | }, 68 | "babel-code-frame": { 69 | "version": "6.22.0", 70 | "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.22.0.tgz", 71 | "integrity": "sha1-AnYgvuVnqIwyVhV05/0IAdMxGOQ=", 72 | "dev": true 73 | }, 74 | "balanced-match": { 75 | "version": "1.0.0", 76 | "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", 77 | "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", 78 | "dev": true 79 | }, 80 | "brace-expansion": { 81 | "version": "1.1.8", 82 | "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", 83 | "integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=", 84 | "dev": true 85 | }, 86 | "caller-path": { 87 | "version": "0.1.0", 88 | "resolved": "https://registry.npmjs.org/caller-path/-/caller-path-0.1.0.tgz", 89 | "integrity": "sha1-lAhe9jWB7NPaqSREqP6U6CV3dR8=", 90 | "dev": true 91 | }, 92 | "callsites": { 93 | "version": "0.2.0", 94 | "resolved": "https://registry.npmjs.org/callsites/-/callsites-0.2.0.tgz", 95 | "integrity": "sha1-r6uWJikQp/M8GaV3WCXGnzTjUMo=", 96 | "dev": true 97 | }, 98 | "chalk": { 99 | "version": "1.1.3", 100 | "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", 101 | "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", 102 | "dev": true 103 | }, 104 | "circular-json": { 105 | "version": "0.3.3", 106 | "resolved": "https://registry.npmjs.org/circular-json/-/circular-json-0.3.3.tgz", 107 | "integrity": "sha512-UZK3NBx2Mca+b5LsG7bY183pHWt5Y1xts4P3Pz7ENTwGVnJOUWbRb3ocjvX7hx9tq/yTAdclXm9sZ38gNuem4A==", 108 | "dev": true 109 | }, 110 | "cli-width": { 111 | "version": "2.1.0", 112 | "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.1.0.tgz", 113 | "integrity": "sha1-sjTKIJsp72b8UY2bmNWEewDt8Ao=", 114 | "dev": true 115 | }, 116 | "co": { 117 | "version": "4.6.0", 118 | "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", 119 | "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=", 120 | "dev": true 121 | }, 122 | "code-point-at": { 123 | "version": "1.1.0", 124 | "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", 125 | "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", 126 | "dev": true 127 | }, 128 | "concat-map": { 129 | "version": "0.0.1", 130 | "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", 131 | "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", 132 | "dev": true 133 | }, 134 | "concat-stream": { 135 | "version": "1.6.0", 136 | "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.0.tgz", 137 | "integrity": "sha1-CqxmL9Ur54lk1VMvaUeE5wEQrPc=", 138 | "dev": true 139 | }, 140 | "core-util-is": { 141 | "version": "1.0.2", 142 | "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", 143 | "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", 144 | "dev": true 145 | }, 146 | "d": { 147 | "version": "1.0.0", 148 | "resolved": "https://registry.npmjs.org/d/-/d-1.0.0.tgz", 149 | "integrity": "sha1-dUu1v+VUUdpppYuU1F9MWwRi1Y8=", 150 | "dev": true 151 | }, 152 | "debug": { 153 | "version": "2.6.8", 154 | "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.8.tgz", 155 | "integrity": "sha1-5zFTHKLt4n0YgiJCfaF4IdaP9Pw=", 156 | "dev": true 157 | }, 158 | "deep-is": { 159 | "version": "0.1.3", 160 | "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", 161 | "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", 162 | "dev": true 163 | }, 164 | "del": { 165 | "version": "2.2.2", 166 | "resolved": "https://registry.npmjs.org/del/-/del-2.2.2.tgz", 167 | "integrity": "sha1-wSyYHQZ4RshLyvhiz/kw2Qf/0ag=", 168 | "dev": true 169 | }, 170 | "doctrine": { 171 | "version": "2.0.0", 172 | "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.0.0.tgz", 173 | "integrity": "sha1-xz2NKQnSIpHhoAejlYBNqLZl/mM=", 174 | "dev": true 175 | }, 176 | "es5-ext": { 177 | "version": "0.10.26", 178 | "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.26.tgz", 179 | "integrity": "sha1-UbISilMbcMT2dkCTpzy+u4IYY3I=", 180 | "dev": true 181 | }, 182 | "es6-iterator": { 183 | "version": "2.0.1", 184 | "resolved": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.1.tgz", 185 | "integrity": "sha1-jjGcnwRTv1ddN0lAplWSDlnKVRI=", 186 | "dev": true 187 | }, 188 | "es6-map": { 189 | "version": "0.1.5", 190 | "resolved": "https://registry.npmjs.org/es6-map/-/es6-map-0.1.5.tgz", 191 | "integrity": "sha1-kTbgUD3MBqMBaQ8LsU/042TpSfA=", 192 | "dev": true 193 | }, 194 | "es6-set": { 195 | "version": "0.1.5", 196 | "resolved": "https://registry.npmjs.org/es6-set/-/es6-set-0.1.5.tgz", 197 | "integrity": "sha1-0rPsXU2ADO2BjbU40ol02wpzzLE=", 198 | "dev": true 199 | }, 200 | "es6-symbol": { 201 | "version": "3.1.1", 202 | "resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.1.tgz", 203 | "integrity": "sha1-vwDvT9q2uhtG7Le2KbTH7VcVzHc=", 204 | "dev": true 205 | }, 206 | "es6-weak-map": { 207 | "version": "2.0.2", 208 | "resolved": "https://registry.npmjs.org/es6-weak-map/-/es6-weak-map-2.0.2.tgz", 209 | "integrity": "sha1-XjqzIlH/0VOKH45f+hNXdy+S2W8=", 210 | "dev": true 211 | }, 212 | "escape-string-regexp": { 213 | "version": "1.0.5", 214 | "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", 215 | "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", 216 | "dev": true 217 | }, 218 | "escope": { 219 | "version": "3.6.0", 220 | "resolved": "https://registry.npmjs.org/escope/-/escope-3.6.0.tgz", 221 | "integrity": "sha1-4Bl16BJ4GhY6ba392AOY3GTIicM=", 222 | "dev": true 223 | }, 224 | "eslint": { 225 | "version": "3.19.0", 226 | "resolved": "https://registry.npmjs.org/eslint/-/eslint-3.19.0.tgz", 227 | "integrity": "sha1-yPxiAcf0DdCJQbh8CFdnOGpnmsw=", 228 | "dev": true, 229 | "dependencies": { 230 | "ajv": { 231 | "version": "4.11.8", 232 | "resolved": "https://registry.npmjs.org/ajv/-/ajv-4.11.8.tgz", 233 | "integrity": "sha1-gv+wKynmYq5TvcIK8VlHcGc5xTY=", 234 | "dev": true 235 | }, 236 | "ansi-escapes": { 237 | "version": "1.4.0", 238 | "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-1.4.0.tgz", 239 | "integrity": "sha1-06ioOzGapneTZisT52HHkRQiMG4=", 240 | "dev": true 241 | }, 242 | "cli-cursor": { 243 | "version": "1.0.2", 244 | "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-1.0.2.tgz", 245 | "integrity": "sha1-ZNo/fValRBLll5S9Ytw1KV6PKYc=", 246 | "dev": true 247 | }, 248 | "figures": { 249 | "version": "1.7.0", 250 | "resolved": "https://registry.npmjs.org/figures/-/figures-1.7.0.tgz", 251 | "integrity": "sha1-y+Hjr/zxzUS4DK3+0o3Hk6lwHS4=", 252 | "dev": true 253 | }, 254 | "inquirer": { 255 | "version": "0.12.0", 256 | "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-0.12.0.tgz", 257 | "integrity": "sha1-HvK/1jUE3wvHV4X/+MLEHfEvB34=", 258 | "dev": true 259 | }, 260 | "is-fullwidth-code-point": { 261 | "version": "1.0.0", 262 | "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", 263 | "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", 264 | "dev": true 265 | }, 266 | "onetime": { 267 | "version": "1.1.0", 268 | "resolved": "https://registry.npmjs.org/onetime/-/onetime-1.1.0.tgz", 269 | "integrity": "sha1-ofeDj4MUxRbwXs78vEzP4EtO14k=", 270 | "dev": true 271 | }, 272 | "pluralize": { 273 | "version": "1.2.1", 274 | "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-1.2.1.tgz", 275 | "integrity": "sha1-0aIUg/0iu0HlihL6NCGCMUCJfEU=", 276 | "dev": true 277 | }, 278 | "progress": { 279 | "version": "1.1.8", 280 | "resolved": "https://registry.npmjs.org/progress/-/progress-1.1.8.tgz", 281 | "integrity": "sha1-4mDHj2Fhzdmw5WzD4Khd4Xx6V74=", 282 | "dev": true 283 | }, 284 | "restore-cursor": { 285 | "version": "1.0.1", 286 | "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-1.0.1.tgz", 287 | "integrity": "sha1-NGYfRohjJ/7SmRR5FSJS35LapUE=", 288 | "dev": true 289 | }, 290 | "run-async": { 291 | "version": "0.1.0", 292 | "resolved": "https://registry.npmjs.org/run-async/-/run-async-0.1.0.tgz", 293 | "integrity": "sha1-yK1KXhEGYeQCp9IbUw4AnyX444k=", 294 | "dev": true 295 | }, 296 | "rx-lite": { 297 | "version": "3.1.2", 298 | "resolved": "https://registry.npmjs.org/rx-lite/-/rx-lite-3.1.2.tgz", 299 | "integrity": "sha1-Gc5QLKVyZl87ZHsQk5+X/RYV8QI=", 300 | "dev": true 301 | }, 302 | "string-width": { 303 | "version": "1.0.2", 304 | "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", 305 | "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", 306 | "dev": true 307 | }, 308 | "table": { 309 | "version": "3.8.3", 310 | "resolved": "https://registry.npmjs.org/table/-/table-3.8.3.tgz", 311 | "integrity": "sha1-K7xULw/amGGnVdOUf+/Ys/UThV8=", 312 | "dev": true, 313 | "dependencies": { 314 | "ansi-regex": { 315 | "version": "3.0.0", 316 | "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", 317 | "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", 318 | "dev": true 319 | }, 320 | "is-fullwidth-code-point": { 321 | "version": "2.0.0", 322 | "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", 323 | "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", 324 | "dev": true 325 | }, 326 | "string-width": { 327 | "version": "2.1.1", 328 | "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", 329 | "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", 330 | "dev": true 331 | }, 332 | "strip-ansi": { 333 | "version": "4.0.0", 334 | "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", 335 | "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", 336 | "dev": true 337 | } 338 | } 339 | } 340 | } 341 | }, 342 | "eslint-config-defaults": { 343 | "version": "9.0.0", 344 | "resolved": "https://registry.npmjs.org/eslint-config-defaults/-/eslint-config-defaults-9.0.0.tgz", 345 | "integrity": "sha1-oJCtwTspNeP0OzzQSKknAWVOWtU=", 346 | "dev": true 347 | }, 348 | "espree": { 349 | "version": "3.4.3", 350 | "resolved": "https://registry.npmjs.org/espree/-/espree-3.4.3.tgz", 351 | "integrity": "sha1-KRC1zNSc6JPC//+qtP2LOjG4I3Q=", 352 | "dev": true 353 | }, 354 | "esprima": { 355 | "version": "4.0.0", 356 | "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.0.tgz", 357 | "integrity": "sha512-oftTcaMu/EGrEIu904mWteKIv8vMuOgGYo7EhVJJN00R/EED9DCua/xxHRdYnKtcECzVg7xOWhflvJMnqcFZjw==", 358 | "dev": true 359 | }, 360 | "esquery": { 361 | "version": "1.0.0", 362 | "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.0.0.tgz", 363 | "integrity": "sha1-z7qLV9f7qT8XKYqKAGoEzaE9gPo=", 364 | "dev": true 365 | }, 366 | "esrecurse": { 367 | "version": "4.2.0", 368 | "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.0.tgz", 369 | "integrity": "sha1-+pVo2Y04I/mkHZHpAtyrnqblsWM=", 370 | "dev": true 371 | }, 372 | "estraverse": { 373 | "version": "4.2.0", 374 | "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.2.0.tgz", 375 | "integrity": "sha1-De4/7TH81GlhjOc0IJn8GvoL2xM=", 376 | "dev": true 377 | }, 378 | "esutils": { 379 | "version": "2.0.2", 380 | "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", 381 | "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", 382 | "dev": true 383 | }, 384 | "event-emitter": { 385 | "version": "0.3.5", 386 | "resolved": "https://registry.npmjs.org/event-emitter/-/event-emitter-0.3.5.tgz", 387 | "integrity": "sha1-34xp7vFkeSPHFXuc6DhAYQsCzDk=", 388 | "dev": true 389 | }, 390 | "exit-hook": { 391 | "version": "1.1.1", 392 | "resolved": "https://registry.npmjs.org/exit-hook/-/exit-hook-1.1.1.tgz", 393 | "integrity": "sha1-8FyiM7SMBdVP/wd2XfhQfpXAL/g=", 394 | "dev": true 395 | }, 396 | "fast-levenshtein": { 397 | "version": "2.0.6", 398 | "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", 399 | "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", 400 | "dev": true 401 | }, 402 | "file-entry-cache": { 403 | "version": "2.0.0", 404 | "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-2.0.0.tgz", 405 | "integrity": "sha1-w5KZDD5oR4PYOLjISkXYoEhFg2E=", 406 | "dev": true 407 | }, 408 | "flat-cache": { 409 | "version": "1.2.2", 410 | "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-1.2.2.tgz", 411 | "integrity": "sha1-+oZxTnLCHbiGAXYezy9VXRq8a5Y=", 412 | "dev": true 413 | }, 414 | "fs.realpath": { 415 | "version": "1.0.0", 416 | "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", 417 | "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", 418 | "dev": true 419 | }, 420 | "generate-function": { 421 | "version": "2.0.0", 422 | "resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.0.0.tgz", 423 | "integrity": "sha1-aFj+fAlpt9TpCTM3ZHrHn2DfvnQ=", 424 | "dev": true 425 | }, 426 | "generate-object-property": { 427 | "version": "1.2.0", 428 | "resolved": "https://registry.npmjs.org/generate-object-property/-/generate-object-property-1.2.0.tgz", 429 | "integrity": "sha1-nA4cQDCM6AT0eDYYuTf6iPmdUNA=", 430 | "dev": true 431 | }, 432 | "glob": { 433 | "version": "7.1.2", 434 | "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", 435 | "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", 436 | "dev": true 437 | }, 438 | "globals": { 439 | "version": "9.18.0", 440 | "resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz", 441 | "integrity": "sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ==", 442 | "dev": true 443 | }, 444 | "globby": { 445 | "version": "5.0.0", 446 | "resolved": "https://registry.npmjs.org/globby/-/globby-5.0.0.tgz", 447 | "integrity": "sha1-69hGZ8oNuzMLmbz8aOrCvFQ3Dg0=", 448 | "dev": true 449 | }, 450 | "graceful-fs": { 451 | "version": "4.1.11", 452 | "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", 453 | "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", 454 | "dev": true 455 | }, 456 | "has-ansi": { 457 | "version": "2.0.0", 458 | "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", 459 | "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", 460 | "dev": true 461 | }, 462 | "ignore": { 463 | "version": "3.3.3", 464 | "resolved": "https://registry.npmjs.org/ignore/-/ignore-3.3.3.tgz", 465 | "integrity": "sha1-QyNS5XrM2HqzEQ6C0/6g5HgSFW0=", 466 | "dev": true 467 | }, 468 | "imurmurhash": { 469 | "version": "0.1.4", 470 | "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", 471 | "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", 472 | "dev": true 473 | }, 474 | "inflight": { 475 | "version": "1.0.6", 476 | "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", 477 | "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", 478 | "dev": true 479 | }, 480 | "inherits": { 481 | "version": "2.0.3", 482 | "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", 483 | "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", 484 | "dev": true 485 | }, 486 | "interpret": { 487 | "version": "1.0.3", 488 | "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.0.3.tgz", 489 | "integrity": "sha1-y8NcYu7uc/Gat7EKgBURQBr8D5A=", 490 | "dev": true 491 | }, 492 | "is-my-json-valid": { 493 | "version": "2.16.0", 494 | "resolved": "https://registry.npmjs.org/is-my-json-valid/-/is-my-json-valid-2.16.0.tgz", 495 | "integrity": "sha1-8Hndm/2uZe4gOKrorLyGqxCeNpM=", 496 | "dev": true 497 | }, 498 | "is-path-cwd": { 499 | "version": "1.0.0", 500 | "resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-1.0.0.tgz", 501 | "integrity": "sha1-0iXsIxMuie3Tj9p2dHLmLmXxEG0=", 502 | "dev": true 503 | }, 504 | "is-path-in-cwd": { 505 | "version": "1.0.0", 506 | "resolved": "https://registry.npmjs.org/is-path-in-cwd/-/is-path-in-cwd-1.0.0.tgz", 507 | "integrity": "sha1-ZHdYK4IU1gI0YJRWcAO+ip6sBNw=", 508 | "dev": true 509 | }, 510 | "is-path-inside": { 511 | "version": "1.0.0", 512 | "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-1.0.0.tgz", 513 | "integrity": "sha1-/AbloWg/vaE95mev9xe7wQpI838=", 514 | "dev": true 515 | }, 516 | "is-property": { 517 | "version": "1.0.2", 518 | "resolved": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz", 519 | "integrity": "sha1-V/4cTkhHTt1lsJkR8msc1Ald2oQ=", 520 | "dev": true 521 | }, 522 | "is-resolvable": { 523 | "version": "1.0.0", 524 | "resolved": "https://registry.npmjs.org/is-resolvable/-/is-resolvable-1.0.0.tgz", 525 | "integrity": "sha1-jfV8YeouPFAUCNEA+wE8+NbgzGI=", 526 | "dev": true 527 | }, 528 | "isarray": { 529 | "version": "1.0.0", 530 | "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", 531 | "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", 532 | "dev": true 533 | }, 534 | "js-tokens": { 535 | "version": "3.0.2", 536 | "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", 537 | "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", 538 | "dev": true 539 | }, 540 | "js-yaml": { 541 | "version": "3.9.1", 542 | "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.9.1.tgz", 543 | "integrity": "sha512-CbcG379L1e+mWBnLvHWWeLs8GyV/EMw862uLI3c+GxVyDHWZcjZinwuBd3iW2pgxgIlksW/1vNJa4to+RvDOww==", 544 | "dev": true 545 | }, 546 | "json-stable-stringify": { 547 | "version": "1.0.1", 548 | "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz", 549 | "integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=", 550 | "dev": true 551 | }, 552 | "jsonify": { 553 | "version": "0.0.0", 554 | "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", 555 | "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=", 556 | "dev": true 557 | }, 558 | "jsonpointer": { 559 | "version": "4.0.1", 560 | "resolved": "https://registry.npmjs.org/jsonpointer/-/jsonpointer-4.0.1.tgz", 561 | "integrity": "sha1-T9kss04OnbPInIYi7PUfm5eMbLk=", 562 | "dev": true 563 | }, 564 | "levn": { 565 | "version": "0.3.0", 566 | "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", 567 | "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", 568 | "dev": true 569 | }, 570 | "lodash": { 571 | "version": "4.17.4", 572 | "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", 573 | "integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=", 574 | "dev": true 575 | }, 576 | "minimatch": { 577 | "version": "3.0.4", 578 | "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", 579 | "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", 580 | "dev": true 581 | }, 582 | "minimist": { 583 | "version": "0.0.8", 584 | "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", 585 | "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", 586 | "dev": true 587 | }, 588 | "mkdirp": { 589 | "version": "0.5.1", 590 | "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", 591 | "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", 592 | "dev": true 593 | }, 594 | "ms": { 595 | "version": "2.0.0", 596 | "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", 597 | "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", 598 | "dev": true 599 | }, 600 | "natural-compare": { 601 | "version": "1.4.0", 602 | "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", 603 | "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", 604 | "dev": true 605 | }, 606 | "number-is-nan": { 607 | "version": "1.0.1", 608 | "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", 609 | "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", 610 | "dev": true 611 | }, 612 | "object-assign": { 613 | "version": "4.1.1", 614 | "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", 615 | "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", 616 | "dev": true 617 | }, 618 | "once": { 619 | "version": "1.4.0", 620 | "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", 621 | "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", 622 | "dev": true 623 | }, 624 | "optionator": { 625 | "version": "0.8.2", 626 | "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz", 627 | "integrity": "sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q=", 628 | "dev": true 629 | }, 630 | "os-homedir": { 631 | "version": "1.0.2", 632 | "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", 633 | "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", 634 | "dev": true 635 | }, 636 | "path-is-absolute": { 637 | "version": "1.0.1", 638 | "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", 639 | "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", 640 | "dev": true 641 | }, 642 | "path-is-inside": { 643 | "version": "1.0.2", 644 | "resolved": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz", 645 | "integrity": "sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM=", 646 | "dev": true 647 | }, 648 | "path-parse": { 649 | "version": "1.0.5", 650 | "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.5.tgz", 651 | "integrity": "sha1-PBrfhx6pzWyUMbbqK9dKD/BVxME=", 652 | "dev": true 653 | }, 654 | "pify": { 655 | "version": "2.3.0", 656 | "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", 657 | "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", 658 | "dev": true 659 | }, 660 | "pinkie": { 661 | "version": "2.0.4", 662 | "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", 663 | "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=", 664 | "dev": true 665 | }, 666 | "pinkie-promise": { 667 | "version": "2.0.1", 668 | "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", 669 | "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", 670 | "dev": true 671 | }, 672 | "prelude-ls": { 673 | "version": "1.1.2", 674 | "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", 675 | "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", 676 | "dev": true 677 | }, 678 | "process-nextick-args": { 679 | "version": "1.0.7", 680 | "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", 681 | "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=", 682 | "dev": true 683 | }, 684 | "readable-stream": { 685 | "version": "2.3.3", 686 | "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz", 687 | "integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==", 688 | "dev": true 689 | }, 690 | "readline2": { 691 | "version": "1.0.1", 692 | "resolved": "https://registry.npmjs.org/readline2/-/readline2-1.0.1.tgz", 693 | "integrity": "sha1-QQWWCP/BVHV7cV2ZidGZ/783LjU=", 694 | "dev": true, 695 | "dependencies": { 696 | "is-fullwidth-code-point": { 697 | "version": "1.0.0", 698 | "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", 699 | "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", 700 | "dev": true 701 | }, 702 | "mute-stream": { 703 | "version": "0.0.5", 704 | "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.5.tgz", 705 | "integrity": "sha1-j7+rsKmKJT0xhDMfno3rc3L6xsA=", 706 | "dev": true 707 | } 708 | } 709 | }, 710 | "rechoir": { 711 | "version": "0.6.2", 712 | "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", 713 | "integrity": "sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=", 714 | "dev": true 715 | }, 716 | "require-uncached": { 717 | "version": "1.0.3", 718 | "resolved": "https://registry.npmjs.org/require-uncached/-/require-uncached-1.0.3.tgz", 719 | "integrity": "sha1-Tg1W1slmL9MeQwEcS5WqSZVUIdM=", 720 | "dev": true 721 | }, 722 | "resolve": { 723 | "version": "1.4.0", 724 | "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.4.0.tgz", 725 | "integrity": "sha512-aW7sVKPufyHqOmyyLzg/J+8606v5nevBgaliIlV7nUpVMsDnoBGV/cbSLNjZAg9q0Cfd/+easKVKQ8vOu8fn1Q==", 726 | "dev": true 727 | }, 728 | "resolve-from": { 729 | "version": "1.0.1", 730 | "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-1.0.1.tgz", 731 | "integrity": "sha1-Jsv+k10a7uq7Kbw/5a6wHpPUQiY=", 732 | "dev": true 733 | }, 734 | "rimraf": { 735 | "version": "2.6.1", 736 | "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.1.tgz", 737 | "integrity": "sha1-wjOOxkPfeht/5cVPqG9XQopV8z0=", 738 | "dev": true 739 | }, 740 | "safe-buffer": { 741 | "version": "5.1.1", 742 | "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", 743 | "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==", 744 | "dev": true 745 | }, 746 | "shelljs": { 747 | "version": "0.7.8", 748 | "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.7.8.tgz", 749 | "integrity": "sha1-3svPh0sNHl+3LhSxZKloMEjprLM=", 750 | "dev": true 751 | }, 752 | "slice-ansi": { 753 | "version": "0.0.4", 754 | "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-0.0.4.tgz", 755 | "integrity": "sha1-7b+JA/ZvfOL46v1s7tZeJkyDGzU=", 756 | "dev": true 757 | }, 758 | "sprintf-js": { 759 | "version": "1.0.3", 760 | "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", 761 | "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", 762 | "dev": true 763 | }, 764 | "string_decoder": { 765 | "version": "1.0.3", 766 | "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", 767 | "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", 768 | "dev": true 769 | }, 770 | "strip-ansi": { 771 | "version": "3.0.1", 772 | "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", 773 | "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", 774 | "dev": true 775 | }, 776 | "strip-bom": { 777 | "version": "3.0.0", 778 | "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", 779 | "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", 780 | "dev": true 781 | }, 782 | "strip-json-comments": { 783 | "version": "2.0.1", 784 | "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", 785 | "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", 786 | "dev": true 787 | }, 788 | "supports-color": { 789 | "version": "2.0.0", 790 | "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", 791 | "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", 792 | "dev": true 793 | }, 794 | "text-table": { 795 | "version": "0.2.0", 796 | "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", 797 | "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", 798 | "dev": true 799 | }, 800 | "through": { 801 | "version": "2.3.8", 802 | "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", 803 | "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", 804 | "dev": true 805 | }, 806 | "tryit": { 807 | "version": "1.0.3", 808 | "resolved": "https://registry.npmjs.org/tryit/-/tryit-1.0.3.tgz", 809 | "integrity": "sha1-OTvnMKlEb9Hq1tpZoBQwjzbCics=", 810 | "dev": true 811 | }, 812 | "type-check": { 813 | "version": "0.3.2", 814 | "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", 815 | "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", 816 | "dev": true 817 | }, 818 | "typedarray": { 819 | "version": "0.0.6", 820 | "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", 821 | "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", 822 | "dev": true 823 | }, 824 | "user-home": { 825 | "version": "2.0.0", 826 | "resolved": "https://registry.npmjs.org/user-home/-/user-home-2.0.0.tgz", 827 | "integrity": "sha1-nHC/2Babwdy/SGBODwS4tJzenp8=", 828 | "dev": true 829 | }, 830 | "util-deprecate": { 831 | "version": "1.0.2", 832 | "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", 833 | "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", 834 | "dev": true 835 | }, 836 | "wordwrap": { 837 | "version": "1.0.0", 838 | "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", 839 | "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", 840 | "dev": true 841 | }, 842 | "wrappy": { 843 | "version": "1.0.2", 844 | "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", 845 | "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", 846 | "dev": true 847 | }, 848 | "write": { 849 | "version": "0.2.1", 850 | "resolved": "https://registry.npmjs.org/write/-/write-0.2.1.tgz", 851 | "integrity": "sha1-X8A4KOJkzqP+kUVUdvejxWbLB1c=", 852 | "dev": true 853 | }, 854 | "xtend": { 855 | "version": "4.0.1", 856 | "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", 857 | "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=", 858 | "dev": true 859 | } 860 | } 861 | } 862 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "lambda-audio", 3 | "version": "1.0.0", 4 | "description": "Run Sound eXchange (SoX), the Swiss Army knife of audio manipulation, with Lame on AWS Lambda.", 5 | "main": "index.js", 6 | "directories": { 7 | "lib": "lib" 8 | }, 9 | "scripts": { 10 | "pretest": "eslint lib spec *.js", 11 | "test": "NODE_ENV=test node spec/support/jasmine-runner.js", 12 | "debug": "NODE_ENV=test node debug spec/support/jasmine-runner.js" 13 | }, 14 | "author": "Slobodan Stojanovic (http://slobodan.me/)", 15 | "license": "MIT", 16 | "devDependencies": { 17 | "eslint": "^3.19.0", 18 | "eslint-config-defaults": "^9.0.0", 19 | "jasmine": "^2.7.0", 20 | "jasmine-spec-reporter": "^4.1.1" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /spec/files/rain.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/stojanovic/lambda-audio/c964a63a168502fee8a4277877b4928bcdd45ac6/spec/files/rain.mp3 -------------------------------------------------------------------------------- /spec/lambda-audio-spec.js: -------------------------------------------------------------------------------- 1 | /* global describe, it, expect */ 2 | 'use strict' 3 | 4 | const path = require('path') 5 | const underTest = require('../lib/lambda-audio') 6 | 7 | const rainMp3Info = ` 8 | Input File : '/Users/slobodan/Github/lambda-sox/spec/files/rain.mp3' 9 | Channels : 2 10 | Sample Rate : 44100 11 | Precision : 16-bit 12 | Duration : 00:00:07.89 = 347861 samples = 591.6 CDDA sectors 13 | File Size : 126k 14 | Bit Rate : 128k 15 | Sample Encoding: MPEG audio (layer I, II or III) 16 | 17 | `.replace(/ {21}/g, '') 18 | 19 | describe('Lambda Audio', () => { 20 | it('should export an object with three functions - sox, soxi and lame', () => { 21 | ['sox', 'soxi', 'lame'].forEach(item => expect(typeof underTest[item]).toBe('function')) 22 | expect(typeof underTest).toBe('object') 23 | }) 24 | 25 | it('should return a promise for each of the functions', () => { 26 | ['sox', 'soxi', 'lame'].forEach(item => { 27 | const func = underTest[item](['-help']) 28 | .catch(() => {}) 29 | expect(typeof func.then).toBe('function') 30 | }) 31 | }) 32 | 33 | it('should show an info about the song if soxi is invoked with a file path as a string', done => { 34 | underTest.soxi(path.join(__dirname, './files/rain.mp3')) 35 | .then(info => { 36 | expect(info).toBe(rainMp3Info) 37 | return info 38 | }) 39 | .then(done) 40 | .catch(done.fail) 41 | }) 42 | 43 | it('should show an info about the song if soxi is invoked with a file path as an array', done => { 44 | underTest.soxi([path.join(__dirname, './files/rain.mp3')]) 45 | .then(info => { 46 | expect(info).toBe(rainMp3Info) 47 | return info 48 | }) 49 | .then(done) 50 | .catch(done.fail) 51 | }) 52 | }) 53 | -------------------------------------------------------------------------------- /spec/support/jasmine-runner.js: -------------------------------------------------------------------------------- 1 | /*global jasmine, require, process*/ 2 | 'use strict' 3 | 4 | const Jasmine = require('jasmine') 5 | const SpecReporter = require('jasmine-spec-reporter').SpecReporter 6 | const noop = function () {} 7 | const jrunner = new Jasmine() 8 | let filter 9 | 10 | process.argv.slice(2).forEach(option => { 11 | if (option === 'full') { 12 | jrunner.configureDefaultReporter({ // remove default reporter logs 13 | print: noop 14 | }) 15 | jasmine.getEnv().addReporter(new SpecReporter()) // add jasmine-spec-reporter 16 | } 17 | 18 | if (option.match('^filter=')) 19 | filter = option.match('^filter=(.*)')[1] 20 | }) 21 | 22 | jrunner.loadConfigFile() // load jasmine.json configuration 23 | jrunner.execute(undefined, filter) 24 | -------------------------------------------------------------------------------- /spec/support/jasmine.json: -------------------------------------------------------------------------------- 1 | { 2 | "spec_dir": "spec", 3 | "spec_files": [ 4 | "**/*[sS]pec.js" 5 | ], 6 | "helpers": [ 7 | "helpers/**/*.js" 8 | ] 9 | } 10 | --------------------------------------------------------------------------------