Managing pipes with Tinybird.js

The following methods allow you to fetch and update information about the available pipes in your account.

pipes() - list available pipes

The pipes() method returns the list of pipes that are accessible with the Auth Token currently in use, independently of the level of access the token grants: PIPES:READ OR PIPES:DROP

pipes()
//norun
let tinyb = tinybird('<token>')
console.log(await tinyb.pipes())

info() - get pipe information

The info() method returns information about a specific pipe.

info()
const tinyb = tinybird('<token>')
const { pipes, error } = await tinyb.pipes()
if (pipes.length !== 0) {
    const pipeName = pipes[0]['name']
    console.log(await tinyb.pipe(pipeName).info())
} else {
    console.log(error || `can't fetch any pipes with this token`)
}

schema() - recover schema of the results of the pipe

schema() returns the schema for the results provided of a specific pipe. It contains a columns array with all the name and types of each column, as well as whether each of them is a nullable field or not.

schema()
let tinyb = tinybird('<token>')
console.log(await tinyb.pipe('<pipe>').schema())

delete() - delete a pipe

delete() drops the pipe. This action can’t be undone.

delete()
//norun
let tinyb = tinybird('<token>')
await tinyb.pipe('<pipe>').delete()