Skip to content

Commit 606198a

Browse files
committed
Added do-nothing and Json serialiser transformers.
1 parent 3f9bb19 commit 606198a

File tree

3 files changed

+36
-31
lines changed

3 files changed

+36
-31
lines changed

dist/LambdaStreamToFirehose-1.3.5.zip

2.64 MB
Binary file not shown.

index.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,18 @@ exports.addNewlineTransformer = function(data, callback) {
120120
callback(null, new Buffer(data + "\n", targetEncoding));
121121
};
122122

123+
/** Convert JSON data to its String representation */
124+
exports.jsonToStringTransformer = function(data, callback) {
125+
// emitting a new buffer as text with newline
126+
callback(null, new Buffer(JSON.stringify(data) + "\n", targetEncoding));
127+
};
128+
129+
/** literally nothing at all transformer - just wrap the object in a buffer */
130+
exports.doNothingTransformer = function(data, callback) {
131+
// emitting a new buffer as text with newline
132+
callback(null, new Buffer(data));
133+
};
134+
123135
/**
124136
* Example transformer that converts a regular expression to delimited text
125137
*/
@@ -143,7 +155,7 @@ exports.regexToDelimiter = function(regex, delimiter, data, callback) {
143155
* create the transformer instance - change this to be regexToDelimter, or your
144156
* own new function
145157
*/
146-
var transformer = exports.addNewlineTransformer.bind(undefined);
158+
var transformer = exports.jsonToStringTransformer.bind(undefined);
147159

148160
/**
149161
* Convenience function which generates the batch set with low and high offsets

package.json

Lines changed: 23 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,24 @@
11
{
2-
"name": "lambda-stream-to-firehose",
3-
"description": "An AWS Lambda function that forwards data from a Kinesis or DynamoDB Update Stream to a Kinesis Firehose Delivery Stream",
4-
"version": "1.3.4",
5-
"dependencies": {
6-
"async":"1.5.2",
7-
"aws-kpl-deagg":"2.1.1"
8-
},
9-
"keywords": [
10-
"amazon",
11-
"aws",
12-
"kinesis",
13-
"firehose",
14-
"lambda"
15-
],
16-
"author": {
17-
"name": "Ian Meyers",
18-
"email": "[email protected]"
19-
},
20-
"main": "index.js",
21-
"license" : "Apache-2.0",
22-
"files": [
23-
"index.js",
24-
"lambda.json",
25-
"tagKinesisStream.sh",
26-
"package.json",
27-
"README.md",
28-
"LICENSE",
29-
"NOTICE.txt"
30-
]
31-
}
2+
"name": "lambda-stream-to-firehose",
3+
"description": "An AWS Lambda function that forwards data from a Kinesis or DynamoDB Update Stream to a Kinesis Firehose Delivery Stream",
4+
"version": "1.3.5",
5+
"dependencies":
6+
{
7+
"async": "1.5.2",
8+
"aws-kpl-deagg": "2.1.1"
9+
},
10+
11+
"keywords":
12+
["amazon","aws","kinesis","firehose","lambda"],
13+
14+
"author":
15+
{
16+
"name": "Ian Meyers",
17+
"email": "[email protected]"
18+
},
19+
20+
"main": "index.js",
21+
"license": "Apache-2.0",
22+
"files":
23+
["index.js","lambda.json","tagKinesisStream.sh","package.json","README.md","LICENSE","NOTICE.txt"]
24+
}

0 commit comments

Comments
 (0)