Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@antongolub
Copy link
Collaborator

continues #949

const getUpperCaseTransform = () =>
  new Transform({
    transform(chunk, encoding, callback) {
      callback(null, String(chunk).toUpperCase())
    },
  })
  
// $ > stream (promisified) > $ 
const o1 = await $`echo "hello"`
   .pipe(getUpperCaseTransform())
   .pipe($`cat`)
   
o1.stdout //  'HELLO\n'

// stream > $
const file = tempfile()
await fs.writeFile(file, 'test')
const o2 = await fs
  .createReadStream(file)
  .pipe(getUpperCaseTransform())
  .pipe($`cat`)
  
o2.stdout //  'TEST'

@antongolub antongolub requested a review from antonmedv November 24, 2024 13:37
@antonmedv antonmedv merged commit 4bb470b into google:main Nov 24, 2024
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants