Skip to content

Commit 170c3ce

Browse files
authored
Updated readme for transformAll example
1 parent 5ddd582 commit 170c3ce

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

README.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -757,10 +757,17 @@ module.exports = {
757757
to: "dest/file.txt",
758758
// The `assets` argument is an assets array for the pattern.from ("src/**/*.txt")
759759
transformAll(assets) {
760+
// The assets parameter contains an array of assets
760761
const result = assets.reduce((accumulator, asset) => {
761-
// The asset content can be obtained from `asset.source` using `source` method.
762-
// The asset content is a [`Buffer`](https://nodejs.org/api/buffer.html) object, it could be converted to a `String` to be processed using `content.toString()`
763-
const content = asset.data;
762+
// Each `asset` contains the following data structure:
763+
// {
764+
// data: [`Buffer`], // asset text content can be obtained via asset.data.toString()
765+
// sourceFilename: [`String`],
766+
// absoluteFilename: [`String`],
767+
// }
768+
// The asset content can be obtained from `asset.data`.
769+
// The asset content is a [`Buffer`](https://nodejs.org/api/buffer.html) object, it could be converted to a `String` to be processed using `data.toString()`
770+
const content = asset.data.toString();
764771

765772
accumulator = `${accumulator}${content}\n`;
766773
return accumulator;

0 commit comments

Comments
 (0)