Socket
Socket
Sign inDemoInstall

get-uri

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

get-uri - npm Package Compare versions

Comparing version 5.0.0 to 6.0.0

./dist/index.js

2

dist/file.js

@@ -36,3 +36,3 @@ "use strict";

// fd after it's done reading
// @ts-ignore - `@types/node` doesn't allow `null` as file path :/
// @ts-expect-error `@types/node` doesn't allow `null` as file path :/
const rs = (0, fs_1.createReadStream)(null, {

@@ -39,0 +39,0 @@ autoClose: true,

@@ -28,4 +28,8 @@ "use strict";

const port = parseInt(url.port || '0', 10) || 21;
const user = url.username || undefined;
const password = url.password || undefined;
const user = url.username
? decodeURIComponent(url.username)
: undefined;
const password = url.password
? decodeURIComponent(url.password)
: undefined;
await client.access({

@@ -32,0 +36,0 @@ host,

@@ -9,3 +9,3 @@ "use strict";

const https_1 = __importDefault(require("https"));
const once_1 = __importDefault(require("@tootallnate/once"));
const events_1 = require("events");
const debug_1 = __importDefault(require("debug"));

@@ -66,3 +66,3 @@ const http_error_1 = __importDefault(require("./http-error"));

const req = mod.get(url, options);
const [res] = await (0, once_1.default)(req, 'response');
const [res] = await (0, events_1.once)(req, 'response');
const code = res.statusCode || 0;

@@ -74,9 +74,9 @@ // assign a Date to this response for the "Cache-Control" delta calculation

// any 2xx response is a "success" code
let type = (code / 100) | 0;
const type = (code / 100) | 0;
// check for a 3xx "redirect" status code
let location = res.headers.location;
const location = res.headers.location;
if (type === 3 && location) {
if (!opts.redirects)
opts.redirects = [];
let redirects = opts.redirects;
const redirects = opts.redirects;
if (redirects.length < maxRedirects) {

@@ -88,5 +88,5 @@ debug('got a "redirect" status code with Location: %o', location);

redirects.push(res);
let newUri = new URL(location, url.href);
const newUri = new URL(location, url.href);
debug('resolved redirect URL: %o', newUri.href);
let left = maxRedirects - redirects.length;
const left = maxRedirects - redirects.length;
debug('%o more redirects allowed after this one', left);

@@ -93,0 +93,0 @@ // check if redirecting to a different protocol

@@ -13,5 +13,8 @@ /// <reference types="node" />

};
type Protocols = typeof protocols;
type ProtocolOpts<T> = {
[P in keyof Protocols]: Protocol<T> extends P ? Parameters<Protocols[P]>[1] : never;
export type Protocols = typeof protocols;
export type ProtocolsOptions = {
[P in keyof Protocols]: NonNullable<Parameters<Protocols[P]>[1]>;
};
export type ProtocolOpts<T> = {
[P in keyof ProtocolsOptions]: Protocol<T> extends P ? ProtocolsOptions[P] : never;
}[keyof Protocols];

@@ -18,0 +21,0 @@ export declare function isValidProtocol(p: string): p is keyof Protocols;

{
"name": "get-uri",
"version": "5.0.0",
"version": "6.0.0",
"description": "Returns a `stream.Readable` from a URI string",

@@ -10,11 +10,6 @@ "main": "./dist/index.js",

],
"scripts": {
"prebuild": "rimraf dist",
"build": "tsc",
"test": "jest",
"prepublishOnly": "npm run build"
},
"repository": {
"type": "git",
"url": "git://github.com/TooTallNate/node-get-uri.git"
"url": "https://github.com/TooTallNate/proxy-agents.git",
"directory": "packages/get-uri"
},

@@ -37,5 +32,2 @@ "keywords": [

"license": "MIT",
"bugs": {
"url": "https://github.com/TooTallNate/node-get-uri/issues"
},
"devDependencies": {

@@ -50,11 +42,10 @@ "@types/debug": "^4.1.7",

"jest": "^29.5.0",
"rimraf": "^3.0.2",
"st": "^1.2.2",
"ts-jest": "^29.1.0",
"typescript": "^4.9.5"
"typescript": "^5.0.4",
"tsconfig": "0.0.0"
},
"dependencies": {
"@tootallnate/once": "^2.0.0",
"basic-ftp": "^5.0.2",
"data-uri-to-buffer": "^3.0.1",
"data-uri-to-buffer": "^5.0.0",
"debug": "^4.3.4",

@@ -65,3 +56,9 @@ "fs-extra": "^8.1.0"

"node": ">= 14"
},
"scripts": {
"build": "tsc",
"test": "jest --env node --verbose --bail",
"lint": "eslint . --ext .ts",
"pack": "node ../../scripts/pack.mjs"
}
}
}
get-uri
=======
### Returns a `stream.Readable` from a URI string
[![Build Status](https://github.com/TooTallNate/node-get-uri/workflows/Node%20CI/badge.svg)](https://github.com/TooTallNate/node-get-uri/actions?workflow=Node+CI)

@@ -18,13 +17,2 @@ This high-level module accepts a URI string and returns a `Readable` stream

Installation
------------
Install with `npm`:
``` bash
$ npm install get-uri
```
Example

@@ -48,4 +36,4 @@ -------

When you pass in a URI in which the resource referenced does not exist on the
destination server, then a `NotFoundError` will be returned. The `code` of the
error instance is set to `"ENOTFOUND"`, so you can special-case that in your code
destination server, then a `NotFoundError` will be thrown. The `code` of the
error instance is set to `"ENOTFOUND"`, so you can check for that value
to detect when a bad filename is requested:

@@ -74,6 +62,6 @@

To do this, pass in a `cache` option to the "options object" argument
To do this, define a `cache` property on the "options object" argument
with the value set to the `stream.Readable` instance that was previously
returned. If the remote resource has not been changed since the last call for
that same URI, then a `NotModifiedError` instance will be returned with it's
that same URI, then a `NotModifiedError` instance will be thrown with its
`code` property set to `"ENOTMODIFIED"`.

@@ -80,0 +68,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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