Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

get-urls

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

get-urls - npm Package Compare versions

Comparing version 0.1.2 to 1.0.0

42

cli.js
#!/usr/bin/env node
'use strict';
var fs = require('fs');
var getUrls = require('./get-urls');
var input = process.argv[2];
var stdin = require('get-stdin');
var pkg = require('./package.json');
var getUrls = require('./');
var argv = process.argv.slice(2);
var input = argv[0];
function stdin(cb) {
var ret = '';
process.stdin.setEncoding('utf8');
process.stdin.on('data', function (data) { ret += data });
process.stdin.on('end', function () { cb(ret) }).resume();
function help() {
console.log([
'',
' ' + pkg.description,
'',
' Usage',
' get-urls <file>',
' cat <file> | get-urls'
].join('\n'));
}
function help() {
console.log('get-urls <input-file>');
console.log('or');
console.log('cat <input-file> | get-urls');
function init(data) {
console.log(getUrls(data).join('\n'));
}
if (process.argv.indexOf('-h') !== -1 || process.argv.indexOf('--help') !== -1) {
if (argv.indexOf('--help') !== -1) {
help();

@@ -25,4 +30,4 @@ return;

if (process.argv.indexOf('-v') !== -1 || process.argv.indexOf('--version') !== -1) {
console.log(require('./package').version);
if (argv.indexOf('--version') !== -1) {
console.log(pkg.version);
return;

@@ -33,10 +38,9 @@ }

if (!input) {
return help();
help();
return;
}
console.log(getUrls(fs.readFileSync(input, 'utf8')).join('\n'));
init(fs.readFileSync(input, 'utf8'));
} else {
stdin(function (data) {
console.log(getUrls(data).join('\n'));
});
stdin(init);
}
{
"name": "get-urls",
"version": "0.1.2",
"version": "1.0.0",
"description": "Get all urls in a string",
"license": "MIT",
"repository": "sindresorhus/get-urls",
"main": "get-urls.js",
"bin": {
"get-urls": "cli.js"
},
"author": {

@@ -16,2 +12,5 @@ "name": "Sindre Sorhus",

},
"bin": {
"get-urls": "cli.js"
},
"engines": {

@@ -41,2 +40,6 @@ "node": ">=0.10.0"

],
"dependencies": {
"array-uniq": "^1.0.0",
"get-stdin": "^1.0.0"
},
"devDependencies": {

@@ -43,0 +46,0 @@ "mocha": "*"

@@ -10,17 +10,7 @@ # get-urls [![Build Status](https://travis-ci.org/sindresorhus/get-urls.svg?branch=master)](https://travis-ci.org/sindresorhus/get-urls)

Download [manually](https://github.com/sindresorhus/get-urls/releases) or with a package-manager.
```bash
```sh
$ npm install --save get-urls
```
```bash
$ bower install --save get-urls
```
```bash
$ component install sindresorhus/get-urls
```
## Usage

@@ -38,16 +28,12 @@

You can also use it as a CLI app by installing it globally:
```bash
```sh
$ npm install --global get-urls
```
#### Usage
```bash
```sh
$ get-urls -h
get-urls <input-file>
or
cat <input-file> | get-urls
Usage
get-urls <file>
cat <file> | get-urls
```

@@ -58,2 +44,2 @@

[MIT](http://opensource.org/licenses/MIT) © [Sindre Sorhus](http://sindresorhus.com)
MIT © [Sindre Sorhus](http://sindresorhus.com)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc