import { expect } from "chai" ; import fs from "fs" ; import "mocha" ; import path from "path" ; import { Client , File , ICreateShare , } from "../client" ; import FakeServer from "../fakeServer" ; import RequestResponseLogEntry from "../requestResponseLogEntry" ; import Share from "../share" ; import { getNextcloudClient } from "./testUtils" ; let client ; describe ( "14-NEXCLOUD-NODE-CLIENT-STREAMS" , function ( ) { beforeEach ( async function ( ) { if ( this . currentTest && this . currentTest . parent ) { client = await getNextcloudClient ( this . currentTest . parent . title + "/" + this . currentTest . title ) ; } } ) ; this . timeout ( 1 * 60 * 1000 ) ; it . skip ( "01 create file from stream" , async ( ) => { const rStream = fs . createReadStream ( __filename ) ; const fileName = "/ncncTest/streams/" + path . basename ( __filename ) ; console . log ( fileName ) ; let file ; file = await client . createFile ( fileName , rStream ) ; await file . delete ( ) ; } ) ; it . skip ( "02 pipe file content stream" , async ( ) => { const sourceFileName = "./src/test/data/text1.txt" ; const rStream = fs . createReadStream ( sourceFileName ) ; const fileName = "/ncncTest/streams/" + path . basename ( sourceFileName ) ; console . log ( fileName ) ; let file ; file = await client . createFile ( fileName , rStream ) ; const dest = fs . createWriteStream ( "./tmp/" + path . basename ( sourceFileName ) ) ; await client . pipeContentStream ( fileName , dest ) ; await file . delete ( ) ; } ) ; } ) ;