random-transactions-sdk 0.3.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,106 +1,16 @@
1
- # requests
2
-
3
- [![Made by unshift][made-by]](http://unshift.io)[![Version npm][version]](http://browsenpm.org/package/requests)[![Build Status][build]](https://travis-ci.org/unshiftio/requests)[![Dependencies][david]](https://david-dm.org/unshiftio/requests)[![Coverage Status][cover]](https://coveralls.io/r/unshiftio/requests?branch=master)[![IRC channel][irc]](http://webchat.freenode.net/?channels=unshift)
4
-
5
- [made-by]: https://img.shields.io/badge/made%20by-unshift-00ffcc.svg?style=flat-square
6
- [version]: https://img.shields.io/npm/v/requests.svg?style=flat-square
7
- [build]: https://img.shields.io/travis/unshiftio/requests/master.svg?style=flat-square
8
- [david]: https://img.shields.io/david/unshiftio/requests.svg?style=flat-square
9
- [cover]: https://img.shields.io/coveralls/unshiftio/requests/master.svg?style=flat-square
10
- [irc]: https://img.shields.io/badge/IRC-irc.freenode.net%23unshift-00a8ff.svg?style=flat-square
11
-
12
- Requests is a small library that implements fully and true streaming XHR for
13
- browsers that support these methods. It uses a variety of proprietary
14
- `responseType` properties to force a streaming connection, even for binary data.
15
- For browsers that don't support this we will simply fallback to a regular but
16
- **async** XHR 1/2 request or ActiveXObject in even older deprecated browsers.
17
-
18
- - Internet Explorer >= 10: `ms-stream`
19
- - FireFox >= 9: `moz-chunked`
20
- - FireFox < 20: `multipart`
21
-
22
- This module comes with build-in protection against ActiveX blocking that is
23
- frequently used in firewalls & virus scanners.
24
-
25
- ## Installation
26
-
27
- The module is released in the public npm registry and can be installed using:
1
+ # random-transactions-sdk
2
+ Generate random transactions data.
28
3
 
4
+ # Installation
29
5
  ```
30
- npm install --save requests
6
+ npm i random-transactions-sdk
31
7
  ```
8
+ # Usage
32
9
 
33
- ## Usage
34
-
35
- The API is a mix between the Fetch API, mixed with EventEmitter API for the
36
- event handling.
37
-
38
- ```js
39
- 'use strict';
40
-
41
- var requests = require('requests');
42
10
  ```
11
+ import {getTransactions} from 'random-transactions-sdk'
43
12
 
44
- Now that we've included the library we can start making requests. The exported
45
- method accepts 2 arguments:
46
-
47
- - **url** Required URL that you want to have requested.
48
- - **options** Optional object with additional configuration options:
49
- - **streaming** Should we use streaming API's to fetch the data, defaults to
50
- `false`.
51
- - **method** The HTTP method that should be used to get the contents, defaults
52
- to `GET`.
53
- - **mode** The request mode, defaults to `cors`
54
- - **headers** Object with header name/value that we need to send to the server.
55
- - **timeout** The timeout in ms before we should abort the request.
56
- - **manual** Manually `open` the request, defaults to `false`.
57
-
58
- ```js
59
- requests('https://google.com/foo/bar', { streaming })
60
- .on('data', function (chunk) {
61
- console.log(chunk)
62
- })
63
- .on('end', function (err) {
64
- if (err) return console.log('connection closed due to errors', err);
65
-
66
- console.log('end');
67
- });
13
+ const data = getTransactions(count)
68
14
  ```
69
15
 
70
- ## Events
71
-
72
- In the example above you can see the that we're listing to various of events.
73
- The following events are emitted:
74
-
75
- - `data` A new chunk of data has been received. It can be a small chunk but also
76
- the full response depending on the environment it's loaded in.
77
- - `destroy` The request instance has been fully destroyed.
78
- - `error` An error occurred while requesting the given URL.
79
- - `end` Done with requesting the URL. An error argument can be supplied if the
80
- connection was closed due to an error.
81
- - `before` Emitted before we send the actual request.
82
- - `send` Emitted after we've succesfully started the sending of the data.
83
-
84
- ### requests#destroy
85
-
86
- Destroy the running XHR request and release all the references that the
87
- `requests` instance holds. It returns a boolean as indication of a successful
88
- destruction.
89
-
90
- ```js
91
- requests.destroy();
92
- ```
93
-
94
- ### Requests.requested
95
-
96
- The total amount of requests that we've made in this library. It also serves as
97
- unique id for each request that we store in `.active`.
98
-
99
- ### Requests.active
100
-
101
- An object that contains all running and active requests. Namespaced under
102
- `request.requested` id and the requests instance.
103
-
104
- ## License
105
-
106
- MIT
16
+ Here count is the number of random transactions to be generated. Default count value is 10 if you dont pass any count.