Skip to content
Permalink
v2.4.1
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
31 lines (27 sloc) 806 Bytes
import stream, {Writable} from 'stream'
import {DependencyFile} from './config-types'
const base64Decode = (str: string): string =>
Buffer.from(str, 'base64').toString('binary')
export const base64DecodeDependencyFile = (
file: DependencyFile
): DependencyFile => {
const fileCopy = JSON.parse(JSON.stringify(file))
fileCopy.content = base64Decode(fileCopy.content)
return fileCopy
}
export const outStream = (prefix: string): Writable => {
return new stream.Writable({
write(chunk, _, next) {
process.stderr.write(`${prefix} | ${chunk.toString()}`)
next()
}
})
}
export const errStream = (prefix: string): Writable => {
return new stream.Writable({
write(chunk, _, next) {
process.stderr.write(`${prefix} | ${chunk.toString()}`)
next()
}
})
}