Changeset e29cc2e for trip-planner-front/node_modules/mime/cli.js
- Timestamp:
- 11/25/21 22:08:24 (3 years ago)
- Branches:
- master
- Children:
- 8d391a1
- Parents:
- 59329aa
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trip-planner-front/node_modules/mime/cli.js
r59329aa re29cc2e 1 1 #!/usr/bin/env node 2 2 3 'use strict'; 4 5 process.title = 'mime'; 6 let mime = require('.'); 7 let pkg = require('./package.json'); 8 let args = process.argv.splice(2); 9 10 if (args.includes('--version') || args.includes('-v') || args.includes('--v')) { 11 console.log(pkg.version); 12 process.exit(0); 13 } else if (args.includes('--name') || args.includes('-n') || args.includes('--n')) { 14 console.log(pkg.name); 15 process.exit(0); 16 } else if (args.includes('--help') || args.includes('-h') || args.includes('--h')) { 17 console.log(pkg.name + ' - ' + pkg.description + '\n'); 18 console.log(`Usage: 19 20 mime [flags] [path_or_extension] 21 22 Flags: 23 --help, -h Show this message 24 --version, -v Display the version 25 --name, -n Print the name of the program 26 27 Note: the command will exit after it executes if a command is specified 28 The path_or_extension is the path to the file or the extension of the file. 29 30 Examples: 31 mime --help 32 mime --version 33 mime --name 34 mime -v 35 mime src/log.js 36 mime new.py 37 mime foo.sh 38 `); 39 process.exit(0); 40 } 41 42 let file = args[0]; 43 let type = mime.getType(file); 3 var mime = require('./mime.js'); 4 var file = process.argv[2]; 5 var type = mime.lookup(file); 44 6 45 7 process.stdout.write(type + '\n');
Note:
See TracChangeset
for help on using the changeset viewer.