stream

Node.js process.exit() will not exit with a createReadStream open

ⅰ亾dé卋堺 提交于 2020-08-21 19:41:31
问题 I have a program that communicates with Asterisk via EAGI. Asterisk opens up my Node.js application and sends it data via STDIN and the program sends Asterisk commands via STDOUT. When a user hangs up, the Node.js process gets sent a SIGHUP command. This is intercepted for cleaner exiting. This functionality is working. Asterisk also sends RAW audio data on fd 3 (STDERR+1). The Node.js process intercepts the data properly, and is able to read the audio, convert it, or anything else that needs

Load base64-encoded data from INI file back to TPicture?

半世苍凉 提交于 2020-08-09 06:54:30
问题 In Delphi 10.4, I have sucessfully saved a valid TPicture base64-encoded to an INI file, using this code: procedure TForm1.SavePictureToIniFile(const APicture: TPicture); // https://stackoverflow.com/questions/63216011/tinifile-writebinarystream-creates-exception var LInput: TMemoryStream; MyIni: TMemIniFile; Base64Enc: TBase64Encoding; ThisFile: string; begin if FileSaveDialog1.Execute then ThisFile := FileSaveDialog1.FileName else EXIT; //CodeSite.Send('TForm1.btnSaveToIniClick: VOR

WriteBinaryStream compressed to INI file?

ε祈祈猫儿з 提交于 2020-08-08 06:29:33
问题 In Delphi 10.4, I try to save a valid TPicture compressed to an INI file, trying to replicate the ZLibCompressDecompress example from the documentation: procedure TForm1.SavePictureToIniFile(const APicture: TPicture); // https://stackoverflow.com/questions/63216011/tinifile-writebinarystream-creates-exception var LInput: TMemoryStream; LOutput: TMemoryStream; MyIni: System.IniFiles.TMemIniFile; ThisFile: string; LZip: TZCompressionStream; begin if FileSaveDialog1.Execute then ThisFile :=

WriteBinaryStream compressed to INI file?

≯℡__Kan透↙ 提交于 2020-08-08 06:29:16
问题 In Delphi 10.4, I try to save a valid TPicture compressed to an INI file, trying to replicate the ZLibCompressDecompress example from the documentation: procedure TForm1.SavePictureToIniFile(const APicture: TPicture); // https://stackoverflow.com/questions/63216011/tinifile-writebinarystream-creates-exception var LInput: TMemoryStream; LOutput: TMemoryStream; MyIni: System.IniFiles.TMemIniFile; ThisFile: string; LZip: TZCompressionStream; begin if FileSaveDialog1.Execute then ThisFile :=

NodeJS get a count of bytes of streaming file download

江枫思渺然 提交于 2020-08-08 04:48:28
问题 In this code I stream a file from a url and save it to a file. Is there a way to also pipe it through something that will count the number of bytes piped? (Which would tell me the file size.) request.stream(url) .pipe(outputFile) Is there some library that would do this by piping the download through it, or a simple way for me to do it myself? 回答1: You can do it like this with request library: const request = require('request'); const fs = require('fs'); var downloaded = 0; request.get(url)

Is there a way to split an InputStream?

送分小仙女□ 提交于 2020-07-23 04:33:37
问题 I wonder if there is a way to "split"/"duplicate" an System.IO.Streams.InputStream from the io-streams package to be forwarded to two processing stages? duplicate :: InputStream a -> IO (InputStream a, InputStream a) I can see that this probably doesn't work with the demand driven nature of streams, but what would be the canonical solution if you need several things to be processed? Would you build a pipeline that "writes to the side"? Like: input >>= countEvents countIORef >>= logEvents

Is there a way to split an InputStream?

我的未来我决定 提交于 2020-07-23 04:33:09
问题 I wonder if there is a way to "split"/"duplicate" an System.IO.Streams.InputStream from the io-streams package to be forwarded to two processing stages? duplicate :: InputStream a -> IO (InputStream a, InputStream a) I can see that this probably doesn't work with the demand driven nature of streams, but what would be the canonical solution if you need several things to be processed? Would you build a pipeline that "writes to the side"? Like: input >>= countEvents countIORef >>= logEvents

Is there a way to split an InputStream?

本秂侑毒 提交于 2020-07-23 04:31:47
问题 I wonder if there is a way to "split"/"duplicate" an System.IO.Streams.InputStream from the io-streams package to be forwarded to two processing stages? duplicate :: InputStream a -> IO (InputStream a, InputStream a) I can see that this probably doesn't work with the demand driven nature of streams, but what would be the canonical solution if you need several things to be processed? Would you build a pipeline that "writes to the side"? Like: input >>= countEvents countIORef >>= logEvents

Is there a way to split an InputStream?

谁说我不能喝 提交于 2020-07-23 04:31:04
问题 I wonder if there is a way to "split"/"duplicate" an System.IO.Streams.InputStream from the io-streams package to be forwarded to two processing stages? duplicate :: InputStream a -> IO (InputStream a, InputStream a) I can see that this probably doesn't work with the demand driven nature of streams, but what would be the canonical solution if you need several things to be processed? Would you build a pipeline that "writes to the side"? Like: input >>= countEvents countIORef >>= logEvents

Spring : Download file from REST controller

≯℡__Kan透↙ 提交于 2020-07-22 07:58:59
问题 I work on a Spring project to make a web app so there is a Tomcat server which permit me to lunch my web app. I've got 2 functionalities on this web app, the first permit me to upload a file on a Postgresql Database (it's works correctly). But after that, i want to be able to download this file. This is my method on my service. public byte[] download(Integer id){ Line line = getById(Line.class, id); int blobLenght; byte[] fileToReturn = null; Blob file = line.getFile(); blobLenght = (int)file