New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

lambda-api

Package Overview
Dependencies
Maintainers
2
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lambda-api - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

99

index.d.ts

@@ -49,3 +49,3 @@ import {

res: Response,
next: () => void
next: NextFunction
) => void;

@@ -56,3 +56,3 @@ export declare type ErrorHandlingMiddleware = (

res: Response,
next: () => void
next: NextFunction
) => void;

@@ -198,7 +198,13 @@ export declare type ErrorCallback = (error?: Error) => void;

status(code: number): this;
sendStatus(code: number): void;
header(key: string, value?: string | Array<string>, append?: boolean): this;
getHeader(key: string): string;
hasHeader(key: string): boolean;
removeHeader(key: string): this;
getLink(

@@ -209,19 +215,35 @@ s3Path: string,

): Promise<string>;
send(body: any): void;
json(body: any): void;
jsonp(body: any): void;
html(body: any): void;
type(type: string): this;
location(path: string): this;
redirect(status: number, path: string): void;
redirect(path: string): void;
cors(options: CorsOptions): this;
error(message: string, detail?: any): void;
error(code: number, message: string, detail?: any): void;
cookie(name: string, value: string, options?: CookieOptions): this;
clearCookie(name: string, options?: CookieOptions): this;
etag(enable?: boolean): this;
cache(age?: boolean | number | string, private?: boolean): this;
modified(date: boolean | string | Date): this;
attachment(fileName?: string): this;
download(

@@ -233,2 +255,3 @@ file: string | Buffer,

): void;
sendFile(

@@ -245,29 +268,60 @@ file: string | Buffer,

get(path: string, ...handler: HandlerFunction[]): void;
get(
path: string,
middleware: Middleware,
...handler: HandlerFunction[]
...middlewaresAndHandler: (Middleware | HandlerFunction)[]
): void;
get(...handler: HandlerFunction[]): void;
post(path: string, ...handler: HandlerFunction[]): void;
post(...handler: HandlerFunction[]): void;
put(path: string, ...handler: HandlerFunction[]): void;
put(...handler: HandlerFunction[]): void;
patch(path: string, ...handler: HandlerFunction[]): void;
patch(...handler: HandlerFunction[]): void;
delete(path: string, ...handler: HandlerFunction[]): void;
delete(...handler: HandlerFunction[]): void;
options(path: string, ...handler: HandlerFunction[]): void;
options(...handler: HandlerFunction[]): void;
head(path: string, ...handler: HandlerFunction[]): void;
head(...handler: HandlerFunction[]): void;
any(path: string, ...handler: HandlerFunction[]): void;
any(...handler: HandlerFunction[]): void;
get(...middlewaresAndHandler: (Middleware | HandlerFunction)[]): void;
post(
path: string,
...middlewaresAndHandler: (Middleware | HandlerFunction)[]
): void;
post(...middlewaresAndHandler: (Middleware | HandlerFunction)[]): void;
put(
path: string,
...middlewaresAndHandler: (Middleware | HandlerFunction)[]
): void;
put(...middlewaresAndHandler: (Middleware | HandlerFunction)[]): void;
patch(
path: string,
...middlewaresAndHandler: (Middleware | HandlerFunction)[]
): void;
patch(...middlewaresAndHandler: (Middleware | HandlerFunction)[]): void;
delete(
path: string,
...middlewaresAndHandler: (Middleware | HandlerFunction)[]
): void;
delete(...middlewaresAndHandler: HandlerFunction[]): void;
options(
path: string,
...middlewaresAndHandler: (Middleware | HandlerFunction)[]
): void;
options(...middlewaresAndHandler: (Middleware | HandlerFunction)[]): void;
head(
path: string,
...middlewaresAndHandler: (Middleware | HandlerFunction)[]
): void;
head(...middlewaresAndHandler: (Middleware | HandlerFunction)[]): void;
any(
path: string,
...middlewaresAndHandler: (Middleware | HandlerFunction)[]
): void;
any(...middlewaresAndHandler: (Middleware | HandlerFunction)[]): void;
METHOD(
method: METHODS | METHODS[],
path: string,
...handler: HandlerFunction[]
...middlewaresAndHandler: (Middleware | HandlerFunction)[]
): void;
METHOD(method: METHODS | METHODS[], ...handler: HandlerFunction[]): void;
METHOD(
method: METHODS | METHODS[],
...middlewaresAndHandler: (Middleware | HandlerFunction)[]
): void;
register(

@@ -277,2 +331,3 @@ routes: (api: API, options?: RegisterOptions) => void,

): void;
routes(format: true): void;

@@ -279,0 +334,0 @@ routes(format: false): string[][];

@@ -11,2 +11,3 @@ 'use strict';

const { getSignedUrl } = require('@aws-sdk/s3-request-presigner');
const { streamToBuffer } = require('./utils');

@@ -17,6 +18,13 @@ // Export

exports.getObject = (params) => {
const cmd = new GetObjectCommand(params);
const promise = this.client.send(cmd);
return {
promise: () => promise,
promise: async () => {
const res = await this.client.send(new GetObjectCommand(params));
if (!res.Body) return res;
return {
...res,
Body: await streamToBuffer(res.Body),
};
},
};

@@ -23,0 +31,0 @@ };

@@ -204,1 +204,9 @@ 'use strict';

);
exports.streamToBuffer = (stream) =>
new Promise((resolve, reject) => {
const chunks = [];
stream.on('data', (chunk) => chunks.push(chunk));
stream.on('error', reject);
stream.on('end', () => resolve(Buffer.concat(chunks)));
});
{
"name": "lambda-api",
"version": "1.0.1",
"version": "1.0.2",
"description": "Lightweight web framework for your serverless applications",

@@ -5,0 +5,0 @@ "main": "index.js",

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