We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a5b3436 commit ff6c64dCopy full SHA for ff6c64d
1 file changed
README.md
@@ -132,11 +132,20 @@ If you wish to apply a transform to text files before they are streamed in
132
response, you can supply a `transform` callback which returns a `stream`
133
`Transform`.
134
135
+For example, if we wished to upper-case everything in text content:
136
+
137
```js
138
+import {Transform} from 'stream';
139
140
const server = http.createServer((req, res) => {
141
const s = new statik.Server(__dirname + '/../fixtures', {
142
transform (fileString, pathname, req, res) {
-
143
+ return new Transform({
144
+ transform(chunk, _enc, cb) {
145
+ // Supply the transformed data as the second argument
146
+ cb(null, chunk.toString().toUpperCase());
147
+ }
148
+ });
149
}
150
});
151
s.serve(req, res);
0 commit comments