<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Dapr Binary Store JavaScript SDK on Dapr Docs</title><link>https://docs.dapr.io/developing-applications/sdks/js/js-binarystore/</link><description>Recent content in Dapr Binary Store JavaScript SDK on Dapr Docs</description><generator>Hugo</generator><language>en</language><atom:link href="https://docs.dapr.io/developing-applications/sdks/js/js-binarystore/index.xml" rel="self" type="application/rss+xml"/><item><title>How to: Manage binary files with the Dapr JavaScript SDK</title><link>https://docs.dapr.io/developing-applications/sdks/js/js-binarystore/js-binarystore-howto/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://docs.dapr.io/developing-applications/sdks/js/js-binarystore/js-binarystore-howto/</guid><description>&lt;p>Use &lt;code>DaprClient.binaryStore&lt;/code> to store and retrieve files through a Dapr binary store component. The client supports binary streams so you can transfer large files without loading the entire file into your application&amp;rsquo;s memory. This guide covers component configuration, uploads, downloads, overwrites, and deletes.&lt;/p>
&lt;h2 id="prerequisites">Prerequisites&lt;/h2>
&lt;ul>
&lt;li>&lt;a href="https://docs.dapr.io/getting-started/install-dapr-cli/">Dapr CLI&lt;/a>&lt;/li>
&lt;li>An initialized &lt;a href="https://docs.dapr.io/getting-started/install-dapr-selfhost/">Dapr environment&lt;/a> with Dapr runtime 1.19 or later&lt;/li>
&lt;li>&lt;a href="https://nodejs.org/">Node.js&lt;/a> 18 or later&lt;/li>
&lt;li>The &lt;a href="https://www.npmjs.com/package/@dapr/dapr">&lt;code>@dapr/dapr&lt;/code>&lt;/a> package, version 3.19.0 or later&lt;/li>
&lt;li>A configured &lt;a href="https://docs.dapr.io/developing-applications/building-blocks/binarystore/">binary store component&lt;/a>, such as the in-memory component below&lt;/li>
&lt;/ul>
&lt;p>In your application directory, initialize an npm project if you do not already have one, then install the SDK:&lt;/p></description></item><item><title>Binary Store client usage</title><link>https://docs.dapr.io/developing-applications/sdks/js/js-binarystore/js-binarystore-client-usage/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://docs.dapr.io/developing-applications/sdks/js/js-binarystore/js-binarystore-client-usage/</guid><description>&lt;p>Binary Store is available through &lt;code>DaprClient.binaryStore&lt;/code> in JavaScript SDK 3.19.0 or later and requires Dapr runtime 1.19 or later. Both HTTP and gRPC use the alpha Binary Store API.&lt;/p>
&lt;h2 id="client-lifetime-and-configuration">Client lifetime and configuration&lt;/h2>
&lt;p>Reuse a long-lived &lt;code>DaprClient&lt;/code> rather than creating a client for each operation. Await outstanding operations before calling &lt;code>await client.stop()&lt;/code> during application shutdown.&lt;/p>
&lt;p>The default protocol is HTTP. To explicitly configure a gRPC connection:&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" class="chroma">&lt;code class="language-javascript" data-lang="javascript">&lt;span class="line">&lt;span class="cl">&lt;span class="kr">import&lt;/span> &lt;span class="p">{&lt;/span> &lt;span class="nx">CommunicationProtocolEnum&lt;/span>&lt;span class="p">,&lt;/span> &lt;span class="nx">DaprClient&lt;/span> &lt;span class="p">}&lt;/span> &lt;span class="nx">from&lt;/span> &lt;span class="s2">&amp;#34;@dapr/dapr&amp;#34;&lt;/span>&lt;span class="p">;&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="kr">const&lt;/span> &lt;span class="nx">client&lt;/span> &lt;span class="o">=&lt;/span> &lt;span class="k">new&lt;/span> &lt;span class="nx">DaprClient&lt;/span>&lt;span class="p">({&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nx">daprHost&lt;/span>&lt;span class="o">:&lt;/span> &lt;span class="s2">&amp;#34;127.0.0.1&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nx">daprPort&lt;/span>&lt;span class="o">:&lt;/span> &lt;span class="s2">&amp;#34;50001&amp;#34;&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nx">communicationProtocol&lt;/span>&lt;span class="o">:&lt;/span> &lt;span class="nx">CommunicationProtocolEnum&lt;/span>&lt;span class="p">.&lt;/span>&lt;span class="nx">GRPC&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl"> &lt;span class="nx">daprApiToken&lt;/span>&lt;span class="o">:&lt;/span> &lt;span class="nx">process&lt;/span>&lt;span class="p">.&lt;/span>&lt;span class="nx">env&lt;/span>&lt;span class="p">.&lt;/span>&lt;span class="nx">DAPR_API_TOKEN&lt;/span>&lt;span class="p">,&lt;/span>
&lt;/span>&lt;/span>&lt;span class="line">&lt;span class="cl">&lt;span class="p">});&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>Use &lt;code>CommunicationProtocolEnum.HTTP&lt;/code> and the sidecar&amp;rsquo;s HTTP port (by default &lt;code>&amp;quot;3500&amp;quot;&lt;/code>) for HTTP. Supply port values as strings.&lt;/p></description></item></channel></rss>