Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

gfscoute

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gfscoute

A tool for fetching & downloading fonts' files from Google Fonts

latest
Source
npmnpm
Version
1.0.1
Version published
Weekly downloads
12
300%
Maintainers
1
Weekly downloads
 
Created
Source

GFScoute V1.0.0

License: MIT

Introduction

gfscoute is a npm tool designed for effortless fonts fetching & downloading from Google Fonts.

Features

  • Download By Name: GFScoute makes it easy to search & download the font by its name.
  • Multiple Extensions Support: The tool will download the font file locally in its original type [.tff, .woff2, etc...].

Installation

To install gfscoute, use npm:

npm install gfscoute

or yarn:

yarn add gfscoute

Usage

To use gfscoute, import or require the DownloadFont from the package:

import DownloadFont from "gfscoute";
const DownloadFont = require("gfscoute");

Example of calling the function /test/:

import { DownloadFont, ScouteFont } from "gfscoute";

const fontName = "Roboto";

ScouteFont(fontName)
  .then((resp) => {
    if (resp) {
      DownloadFont(fontName)
        .then(console.log("Success"))
        .catch((error) => {
          // Handle the error as you want here
          console.log(error);
        });
    } else {
      // Hadnle font not found case
    }
  })
  .catch((error) => {
    // Handle error
  });

Complete example:

"use client";

import { useState } from "react";
import DownloadFont from "gfscoute";

export default function Fonts() {
  const [fontName, setFontName] = useState("");

  const hadnleDownload = (name: string) => {
    DownloadFont(name)
      .then(() => console.log("Success"));
      .catch((error: Error) => {
        throw error;
      });
  };

  return (
    <>
      <h1>Type font's name</h1>
      <input
        id="fontName"
        value={fontName}
        onChange={(e) => setFontName(e.target.value)}
      />
      <button onClick={() => hadnleDownload(fontName)}>
        {" "}
        Download Font
      </button>
    </>
  );
}

Keywords

Google fonts

FAQs

Package last updated on 22 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts