Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

resp

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

resp

An implementation of the Redis Encoding and Serialization Protocol for Node.

latest
npmnpm
Version
0.1.1
Version published
Weekly downloads
20
11.11%
Maintainers
1
Weekly downloads
 
Created
Source

Resp

An implementation of the Redis Encoding and Serialization Protocol for Node.js.

Example

resp.stringify(['MAKE', 'Widget', 6, '$0.40', true])
// => '*5\r\n$4\r\nMAKE\r\n$6\r\nWidget\r\n:6\r\n$5\r\n$0.40\r\n:1\r\n'
resp.parse('+A-OK\r\n')
// => { message: 'A-OK' }

Serialize: resp.stringify(value)

Stringifies value into its RESP representation, returning the result as a String. The legal values (as specified by RESP) are:

  • "Status objects", which have a single message string (e.g. { "message": "This is the status message." }).
  • Error objects
  • Booleans
  • Strings
  • Numbers
  • Arrays including any of the above

Other types and values will throw a TypeError describing the issue.

Deserialize: resp.parse(string)

Parses the RESP in string, returning the represented value as its native type. See resp.stringify, above, for the supported types that may be returned.

If the input is not valid RESP, a SyntaxError will be thrown describing the issue.

TODO

  • Optimization
  • Transform streams

FAQs

Package last updated on 17 Jun 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts