Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

README.md 1.9KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. # responselike
  2. > A response-like object for mocking a Node.js HTTP response stream
  3. [![Build Status](https://travis-ci.org/lukechilds/responselike.svg?branch=master)](https://travis-ci.org/lukechilds/responselike)
  4. [![Coverage Status](https://coveralls.io/repos/github/lukechilds/responselike/badge.svg?branch=master)](https://coveralls.io/github/lukechilds/responselike?branch=master)
  5. [![npm](https://img.shields.io/npm/dm/responselike.svg)](https://www.npmjs.com/package/responselike)
  6. [![npm](https://img.shields.io/npm/v/responselike.svg)](https://www.npmjs.com/package/responselike)
  7. Returns a streamable response object similar to a [Node.js HTTP response stream](https://nodejs.org/api/http.html#http_class_http_incomingmessage). Useful for formatting cached responses so they can be consumed by code expecting a real response.
  8. ## Install
  9. ```shell
  10. npm install --save responselike
  11. ```
  12. Or if you're just using for testing you'll want:
  13. ```shell
  14. npm install --save-dev responselike
  15. ```
  16. ## Usage
  17. ```js
  18. const Response = require('responselike');
  19. const response = new Response(200, { foo: 'bar' }, Buffer.from('Hi!'), 'https://example.com');
  20. response.statusCode;
  21. // 200
  22. response.headers;
  23. // { foo: 'bar' }
  24. response.body;
  25. // <Buffer 48 69 21>
  26. response.url;
  27. // 'https://example.com'
  28. response.pipe(process.stdout);
  29. // Hi!
  30. ```
  31. ## API
  32. ### new Response(statusCode, headers, body, url)
  33. Returns a streamable response object similar to a [Node.js HTTP response stream](https://nodejs.org/api/http.html#http_class_http_incomingmessage).
  34. #### statusCode
  35. Type: `number`
  36. HTTP response status code.
  37. #### headers
  38. Type: `object`
  39. HTTP headers object. Keys will be automatically lowercased.
  40. #### body
  41. Type: `buffer`
  42. A Buffer containing the response body. The Buffer contents will be streamable but is also exposed directly as `response.body`.
  43. #### url
  44. Type: `string`
  45. Request URL string.
  46. ## License
  47. MIT © Luke Childs