fast-base64
esm.sh
Our great sponsors
fast-base64 | esm.sh | |
---|---|---|
1 | 56 | |
43 | 2,770 | |
- | 2.9% | |
2.6 | 9.8 | |
about 2 years ago | 10 days ago | |
JavaScript | Go | |
MIT License | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
fast-base64
We haven't tracked posts mentioning fast-base64 yet.
Tracking mentions began in Dec 2020.
esm.sh
-
Show HN: Comma Separated Values (CSV) to Unicode Separated Values (USV)
const extism = await import("https://esm.sh/@extism/extism");
-
JSR: The JavaScript Registry
Unpkg just serves the raw files, which may contain require() calls or import from other npm packages. That won’t work.
The closest service is https://esm.sh, but you can’t download from it.
Unpkg serves whatever is published to NPM, and if it's a library intended for the browser, that often includes minified versions ready for use in script tags, for example, https://unpkg.com/[email protected]/mithril.min.js. Sometimes the default export is CJS (which has require() calls), in which case, you can usually use the browse url that I mentioned to see if there's another export you can use.
https://esm.sh/ is definitely a good option too if you're OK with modules.
-
Deno Cron
* Change my NPM imports to something that would work with Deno. The most straightforward thing to do was just change `import "foo"` to `import "npm:foo"`, but this felt hacky so eventually I used https://esm.sh, which worked for some packages but not others.
-
Let's optimize dependency management with URL Imports
Easily serve libraries from local server/private VPS: You can try to serve and cache libraries by running esm.sh to improve loading times on your server side. Or to keep things simple, just upload a code to pastebin or similar services and directly use it here!
-
Building a Slack Bot for AI-Powered Conversations with Supabase
import { serve } from 'https://deno.land/[email protected]/http/server.ts'; import { WebClient } from 'https://deno.land/x/[email protected]/mod.js'; import { SupabaseClient } from 'https://esm.sh/@supabase/supabase-js@2'; const slack_bot_token = Deno.env.get("SLACK_TOKEN") ?? ""; const bot_client = new WebClient(slack_bot_token); const supabase_url = Deno.env.get("SUPABASE_URL") ?? ""; const service_role = Deno.env.get("SUPABASE_SERVICE_ROLE_KEY"); const supabase = new SupabaseClient(supabase_url, service_role); console.log(`Slack URL verification function up and running!`); serve(async (req) => { try { const req_body = await req.json(); console.log(JSON.stringify(req_body, null, 2)); const { token, challenge, type, event } = req_body; if (type == 'url_verification') { return new Response(JSON.stringify({ challenge }), { headers: { 'Content-Type': 'application/json' }, status: 200, }); } else if (event.type == 'app_mention') { const { user, text, channel, ts } = event; const url_path = text.toLowerCase() .includes('code') ? '/code' : '/general'; const { error } = await supabase.from('job_queue').insert({ http_verb: 'POST', payload: { user, text, channel, ts }, url_path: url_path }); if (error) { console.error(error); return new Response(JSON.stringify({ error: error.message }), { headers: { 'Content-Type': 'application/json' }, status: 400, }); } await post(channel, ts, `Taking a look and will get back to you shortly!`); return new Response('', { status: 200 }); } } catch (error) { return new Response(JSON.stringify({ error: error.message }), { headers: { 'Content-Type': 'application/json' }, status: 400, }); } }); async function post(channel: string, thread_ts: string, message: string): Promise { try { const result = await bot_client.chat.postMessage({ channel: channel, thread_ts: thread_ts, text: message, }); console.info(result); } catch (e) { console.error(`Error posting message: ${e}`); } }
-
What is Embedding? Generating Embedding using Supabase
import { createClient } from "https://esm.sh/@supabase/supabase-js@2"; export const supabaseClient = await createClient( Deno.env.get("SUPABASE_URL") ?? "", Deno.env.get("SUPABASE_ANON_KEY") ?? "" );
-
Deno Fresh SVG Sprites: Optimized Icons
{ "lock": false, "tasks": { "start": "deno run -A --watch=static/,routes/ dev.ts", "update": "deno run -A -r https://fresh.deno.dev/update .", "minify": "deno run --allow-env=DENO_ENV --allow-read --allow-run --allow-write minify-svg-sprite.ts" }, "imports": { "@/": "./", "$fresh/": "https://deno.land/x/[email protected]/", "preact": "https://esm.sh/[email protected]", "preact/": "https://esm.sh/[email protected]/", "preact-render-to-string": "https://esm.sh/*[email protected]", "@preact/signals": "https://esm.sh/*@preact/[email protected]", "@preact/signals-core": "https://esm.sh/*@preact/[email protected]", "$std/": "https://deno.land/[email protected]/", "svgo": "https://esm.sh/[email protected]/" }, "compilerOptions": { "jsx": "react-jsx", "jsxImportSource": "preact" } }
-
Testing Supabase Edge Functions with Deno Test
// deno-test.ts // Import necessary libraries and modules import { assert, assertExists, assertEquals, } from "https://deno.land/[email protected]/testing/asserts.ts"; import { createClient, SupabaseClient, } from "https://esm.sh/@supabase/[email protected]"; import { delay } from 'https://deno.land/x/[email protected]/mod.ts'; // Setup the Supabase client configuration const supabaseUrl = Deno.env.get("SUPABASE_URL") ?? ""; const supabaseKey = Deno.env.get("SUPABASE_ANON_KEY") ?? ""; const options = { auth: { autoRefreshToken: false, persistSession: false, detectSessionInUrl: false } }; // Test the creation and functionality of the Supabase client const testClientCreation = async () => { var client: SupabaseClient = createClient(supabaseUrl, supabaseKey, options); // Check if the Supabase URL and key are provided if (!supabaseUrl) throw new Error('supabaseUrl is required.') if (!supabaseKey) throw new Error('supabaseKey is required.') // Test a simple query to the database const { data: table_data, error: table_error } = await client.from('my_table').select('*').limit(1); if (table_error) { throw new Error('Invalid Supabase client: ' + table_error.message); } assert(table_data, "Data should be returned from the query."); }; // Test the 'hello-world' function const testHelloWorld = async () => { var client: SupabaseClient = createClient(supabaseUrl, supabaseKey, options); // Invoke the 'hello-world' function with a parameter const { data: func_data, error: func_error } = await client.functions.invoke('hello-world', { body: { name: 'bar' } }); // Check for errors from the function invocation if (func_error) { throw new Error('Invalid response: ' + func_error.message); } // Log the response from the function console.log(JSON.stringify(func_data, null, 2)); // Assert that the function returned the expected result assertEquals(func_data.message, 'Hello bar!'); }; // Register and run the tests Deno.test("Client Creation Test", testClientCreation); Deno.test("Hello-world Function Test", testHelloWorld);
-
Secure Password Verification and Update with Supabase and PostgreSQL
import { serve } from "https://deno.land/[email protected]/http/server.ts"; import { createClient } from "https://esm.sh/@supabase/supabase-js@2"; const corsHeaders = { "Access-Control-Allow-Origin": "*", "Access-Control-Allow-Headers": "authorization, x-client-info, apikey, content-type", }; serve(async (req) => { // Create a Supabase client with the necessary credentials if (req.method === 'OPTIONS') { return new Response('ok', { headers: corsHeaders }) } // Create a Supabase client with the necessary credentials const supabaseClient = createClient( Deno.env.get("SUPABASE_URL") ?? "", Deno.env.get("SUPABASE_ANON_KEY") ?? "", { global: { headers: { Authorization: req.headers.get("Authorization")! } }, auth: { autoRefreshToken: false, persistSession: false, detectSessionInUrl: false } } ); console.log("Supabase client created"); // Fetch the logged-in user from Supabase const { data: { user }, error: userError } = await supabaseClient.auth .getUser(); console.log("User fetched", user); if (userError) { console.error("User error", userError); return new Response(JSON.stringify({ error: userError.message }), { headers: { ...corsHeaders, "Content-Type": "application/json" }, status: 400, }); } // Extract the old and new passwords from the request const { oldPassword, newPassword } = await req.json(); console.log("Received old and new passwords", oldPassword, newPassword); // Verify the old password using the `verify_user_password` function const { data: isValidOldPassword, error: passwordError } = await supabaseClient.rpc("verify_user_password", { password: oldPassword }); console.log("Old password verified", isValidOldPassword); if (passwordError || !isValidOldPassword) { console.error("Invalid old password", passwordError); return new Response(JSON.stringify({ error: "Invalid old password" }), { headers: { ...corsHeaders, "Content-Type": "application/json" }, status: 400, }); } try { // Fetch the user's profile data const { data: profiles, error: profileError } = await supabaseClient.from( "profiles", ).select("id, avatar_url"); console.log("Profile data fetched", profiles); if (profileError) throw profileError; const user_id = profiles[0].id; console.log("User id", user_id); // Update the user's password using the Supabase Admin API const supabaseAdmin = createClient( Deno.env.get("SUPABASE_URL") ?? "", Deno.env.get("SUPABASE_SERVICE_ROLE_KEY") ?? "", { auth: { autoRefreshToken: false, persistSession: false, detectSessionInUrl: false } } ); console.log("Admin client created"); // Return a success response to the client const { error: updateError } = await supabaseAdmin .auth.admin.updateUserById( user_id, { password: newPassword }, ); console.log("Password updated"); if (updateError) { console.error("Update error", updateError); return new Response(JSON.stringify({ error: updateError.message }), { status: 400, }); } } catch (error) { console.error("Caught error", error); return new Response(JSON.stringify({ error: error }), { headers: { ...corsHeaders, "Content-Type": "application/json" }, status: 400, }); } console.log("Password update successful"); // Return a success response to the client return new Response( JSON.stringify({ message: "Password updated successfully" }), { headers: { ...corsHeaders, "Content-Type": "application/json" }, status: 200, }, ); });
What are some alternatives?
import-maps - How to control the behavior of JavaScript imports
jsdelivr - A free, fast, and reliable Open Source CDN for npm, GitHub, Javascript, and ESM
deno - A modern runtime for JavaScript and TypeScript.
esbuild - An extremely fast bundler for the web
eleventy-high-performance-blog - A high performance blog template for the 11ty static site generator.
dayjs - ⏰ Day.js 2kB immutable date-time library alternative to Moment.js with the same modern API
Shinobi - :peace_symbol: :palestinian_territories: Shinobi CE - The Free Open Source CCTV platform written in Node.JS (Camera Recorder - Security Surveillance Software - Restreamer
deno-xml-parser - XML parser ported from https://github.com/segmentio/xml-parser
TypeScript - TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
CommunityWriterPrograms - A list of Developer Community Writer Programs
responsively-app - A modified web browser that helps in responsive web development. A web developer's must have dev-tool.
Speed Measure Plugin - ⏱ See how fast (or not) your plugins and loaders are, so you can optimise your builds