memorystream

Kentico - Pass MemoryStream file to MediaFileInfo API

谁说胖子不能爱 提交于 2021-02-10 14:20:38
问题 I have created a iTextSharp PDF file that is created to a MemoryStream. But I now need to pass this file to the Kentico media library. I would be grateful if anyone could show my how to do this. The code I have currently is: //Media Library Info - takes Media Library Name and Website Name MediaLibraryInfo libraryInfo = MediaLibraryInfoProvider.GetMediaLibraryInfo("MyLibrary", CMSContext.CurrentSiteName); //Folder in Media Library where Item will be Inserted string mediaLibraryFolder = folder;

When uploading memory stream with contents created by csvhelper using SSH.NET to SFTP server, the uploaded file is empty

一世执手 提交于 2021-02-08 07:28:31
问题 I'm truing to send a CSV with csvhelper. But when I send it, it is always empty. using (var sftProvider =new SFTProvider(Configuration)) using (var csvProvider=new CSVProvider(Configuration)) using (Stream fileStream = new MemoryStream()) { var sftp = sftProvider.SFTPConnection("", "", ""); var nameFile = "/ethias/"+DateTime.Now.ToString(DateFormatConstants.DATE_FORMAT) + ".csv"; if (sftp.Exists(nameFile)) { sftProvider.ReadFileSFTP(sftp, nameFile, fileStream); } await csvProvider.WriteCsv

Node js, piping pdfkit to a memory stream

送分小仙女□ 提交于 2020-06-09 17:11:41
问题 I am using pdfkit (https://github.com/devongovett/pdfkit) on my node server, typically creating pdf files, and then uploading them to s3. The problem is that pdfkit examples pipe the pdf doc into a node write stream, which writes the file to the disk, I followed the example and worked correctly, however my requirement now is to pipe the pdf doc to a memory stream rather than save it on the disk (I am uploading to s3 anyway). I've followed some node memory streams procedures but none of them

GZipStream from MemoryStream only returns a few hundred bytes

大憨熊 提交于 2020-05-26 03:57:52
问题 I am trying to download a .gz file of a few hundred MBs, and turn it into a very long string in C#. using (var memstream = new MemoryStream(new WebClient().DownloadData(url))) using (GZipStream gs = new GZipStream(memstream, CompressionMode.Decompress)) using (var outmemstream = new MemoryStream()) { gs.CopyTo(outmemstream); string t = Encoding.UTF8.GetString(outmemstream.ToArray()); Console.WriteLine(t); } My test URL: https://commoncrawl.s3.amazonaws.com/crawl-data/CC-MAIN-2017-47/segments

Convert float to its binary representation (using MemoryStream?)

痞子三分冷 提交于 2020-02-02 02:27:23
问题 I'd like to convert a given float into its binary representation. I tried to write the float value into a MemoryStream , read this MemoryStream byte by byte and convert the bytes into their binary representation. But every attempt failed. "Can't read closed stream" (but I only closed the writer) For test purposes I simply wrote an integer (I think four bytes in size) and the length of the MemoryStream was 0, when I didn't flush the StreamWriter , and 1, when I did. I'm sure there is a better

Reading from the Pipeline Stream in PowerShell

早过忘川 提交于 2020-01-25 23:46:51
问题 Background I'm hoping to write code which uses Microsoft.VisualBasic.FileIO.TextFieldParser to parse some csv data. The system I'm generating this data for doesn't understand quotes; so I can't escape the delimiter; but rather have to replace it. I've found a solution using the above text parser, but I've only seen people use it with input from files. Rather than writing my data to file only to import it again, I'd rather keep things in memory / make use of this class's constructor which