<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>File-Uploads on Daniel Mejía R.</title>
		<link>https://daniel-m.github.io/tags/file-uploads/</link>
		<description>Recent content in File-Uploads on Daniel Mejía R.</description>
		<generator>Hugo</generator>
		<language>en</language>
		
		
		
		
			<lastBuildDate>Fri, 20 Nov 2026 00:12:37 -0500</lastBuildDate>
		
			<atom:link href="https://daniel-m.github.io/tags/file-uploads/index.xml" rel="self" type="application/rss+xml" />
			<item>
				<title>A second look to Multer DOS</title>
				<link>https://daniel-m.github.io/2026/11/a-second-look-to-multer-dos/</link>
				<pubDate>Thu, 19 Nov 2026 18:51:39 -0500</pubDate>
				<guid>https://daniel-m.github.io/2026/11/a-second-look-to-multer-dos/</guid>
				<description>&lt;p&gt;For context check &lt;a href=&#34;https://daniel-m.github.io/2022/06/expressjs-uploads-to-digital-ocean-spaces-through-s3-aws-s3/&#34; &gt;an old post&lt;/a&gt;&lt;/p&gt;&#xA;&lt;p&gt;To keep things short, I&amp;rsquo;ve been doing some software archeology on my pasts projects. I noticed that my opensourced project &lt;a href=&#34;https://github.com/Daniel-M/multer-dos&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;https://github.com/Daniel-M/multer-dos&lt;/a&gt; was getting about 10 downloads a week on the npm registry &lt;a href=&#34;https://www.npmjs.com/package/multer-dos&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;https://www.npmjs.com/package/multer-dos&lt;/a&gt; so i decided to add support for typescript and dependency updates. The project is so easy to maintain, I guess part of the 10 downloads per week means this is still used in production by some people, so thanks for believing in me&lt;/p&gt;</description>
			</item>
			<item>
				<title>ExpressJS uploads to Digital Ocean Spaces through S3 AWS-S3</title>
				<link>https://daniel-m.github.io/2022/06/expressjs-uploads-to-digital-ocean-spaces-through-s3-aws-s3/</link>
				<pubDate>Tue, 07 Jun 2022 08:46:43 -0500</pubDate>
				<guid>https://daniel-m.github.io/2022/06/expressjs-uploads-to-digital-ocean-spaces-through-s3-aws-s3/</guid>
				<description>&lt;p&gt;This is a short story.&#xA;I was trying to use &lt;a href=&#34;https://github.com/anacronw/multer-s3&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;multer-s3&lt;/a&gt; to perform uploads to Digital-Ocean-Spaces (DOS) using the AWS S3 protocol. It ended up failing to make things work with the things available and ended up implementing my own plugin to perform multipart uploads as an expressjs middleware. You can check the code here,&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://github.com/Daniel-M/multer-dos&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;https://github.com/Daniel-M/multer-dos&lt;/a&gt;&lt;/li&gt;&#xA;&lt;li&gt;&lt;a href=&#34;https://www.npmjs.com/package/multer-dos&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;https://www.npmjs.com/package/multer-dos&lt;/a&gt;&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;The options are the same as the ones in &lt;a href=&#34;https://www.npmjs.com/package/multer&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;multer documentation&lt;/a&gt;. To use the plugin just import the module and create a custom storage&#xA;object to be passed as the &lt;code&gt;storage&lt;/code&gt; option of &lt;code&gt;multer&lt;/code&gt; like in the snippet below,&lt;/p&gt;</description>
			</item>
			<item>
				<title>A mystery using Python hashlib to calculate checksums</title>
				<link>https://daniel-m.github.io/2020/02/a-mystery-using-python-hashlib-to-calculate-checksums/</link>
				<pubDate>Tue, 04 Feb 2020 16:17:42 -0500</pubDate>
				<guid>https://daniel-m.github.io/2020/02/a-mystery-using-python-hashlib-to-calculate-checksums/</guid>
				<description>&lt;p&gt;Recently I was working with hashing some files in order to take checksums to avoid&#xA;working with data-corrupted files received at the endpoint of a web server.&#xA;It sounds easy, receive the file, calculate the hash, and emit the response.&#xA;I only needed something like &lt;code&gt;hash = calculate_hash(file)&lt;/code&gt;.&lt;br&gt;&#xA;A five minute research on &lt;a href=&#34;http://duckduckgo.com&#34;  class=&#34;external-link&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;duckduckgo&lt;/a&gt; lead me to write the following code,&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#282a36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;&#34;&gt;&lt;code class=&#34;language-fallback&#34; data-lang=&#34;fallback&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;import hashlib&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;def calculate_hash(filepath, chunk_size=4096, hash_method=hashlib.md5()):&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    hasher = hash_method&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    with open(filepath, &amp;#39;rb&amp;#39;) as fp:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        buffer = fp.read(chunk_size)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;        while len(buffer) &amp;gt; 0:&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            hasher.update(buffer)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;            buffer = fp.read(chunk_size)&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;    return hasher.hexdigest()&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Open a file in binary mode and read it chunk-wise, updating a hash&#xA;with each chunk until EOF. Easy, right? WRONG!&lt;/p&gt;</description>
			</item>
	</channel>
</rss>
