npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

sms-packet-count

v1.0.3

Published

The "packetCount" in the provided code likely represents the count of SMS packets or messages that will be generated based on the user's input message length, considering the limitations of SMS character encoding and length.

Downloads

12

Readme

Installation

This package is in JavaScript, install with npm:

  npm install sms-packet-count

SMS-PACKET-COUNT

The determination of SMS packet count involves assessing encoding methods (GSM 7-bit or Unicode) for character representation, with GSM 7-bit accommodating limited characters and Unicode supporting a broader set, influencing the segmentation of messages into packets for transmission efficiency.

Unicode Encoding

Unicode is a character encoding standard that represents most of the world's written languages. It uses a 16-bit encoding scheme, allowing it to represent a wide range of characters. In SMS messages, Unicode encoding is used when the message includes characters outside the GSM 7-bit character set.

  • Character Set: Unicode can represent a vast number of characters, including special characters, emojis, and characters from various languages.
  • Size: Each Unicode character is represented using 16 bits (2 bytes).
  • Message Length: Unicode-encoded messages will have a maximum length of 70 characters per SMS.

GSM 7-bit Encoding

GSM 7-bit encoding is a character encoding standard specifically designed for SMS messages in GSM networks. It is a compact encoding that allows for the transmission of text messages using a 7-bit alphabet.

  • Character Set: The GSM 7-bit character set includes the basic Latin alphabet, digits 0-9, and some special characters.
  • Size: Each character is represented using 7 bits, allowing for 128 different characters.
  • Message Length: GSM 7-bit encoded messages will have a maximum length of 160 characters per SMS.

Packet Count:

The concept of "packet count" is more commonly associated with data communication protocols like TCP/IP, where data is divided into packets for transmission. In the context of SMS, messages are usually referred to in terms of character count or message parts.

  • Message Parts: If a message exceeds the maximum length for a single SMS (e.g., more than 160 characters for GSM 7-bit or 70 characters for Unicode), it will be split into multiple parts.
  • Concatenation: These parts are then sent separately, and the receiving device must reassemble them to reconstruct the complete message.
  • Message Length: Unicode-encoded messages will have a maximum length of 70 characters per SMS.
  • Header Overhead: When messages are split, each part includes a header that consumes some of the available character space.

In summary, when working with SMS messages, consider the character encoding (Unicode or GSM 7-bit) and be aware of the maximum length limitations. If a message exceeds these limits, it will be split into multiple parts, and each part may be subject to additional header overhead. The actual "packet count" would depend on the length of the message and the encoding used.

Usage/Examples - REACT

import {getCharset , getPartCount , getCharacterCount} from 'sms-packet-count'

const message = "Eren Yeager (エレン・イェーガー Eren Yēgā?) was a former member of the Survey Corps. He was the main protagonist of Attack on Titan. He lived in Shiganshina District with his parents until the fall of Wall Maria, where he impotently witnessed his mother being eaten by a Titan.[33] This event would lead to Eren's intense hatred towards the Titans as he swore to wipe all of them off the face of the Earth.Soon afterward, his father, Grisha Yeager, found him and gave him the key to his basement, instructing Eren to find it at all costs and retake Wall Maria.[ He then injected Eren with a Titan serum."

console.log(getCharset(message) , getPartCount(message) , getCharacterCount(message));

Usage/Examples - Node

const { getCharset, getPartCount, getCharacterCount } = require('sms-packet-count');


const message = "Eren Yeager (エレン・イェーガー Eren Yēgā?) was a former member of the Survey Corps. He was the main protagonist of Attack on Titan. He lived in Shiganshina District with his parents until the fall of Wall Maria, where he impotently witnessed his mother being eaten by a Titan.[33] This event would lead to Eren's intense hatred towards the Titans as he swore to wipe all of them off the face of the Earth.Soon afterward, his father, Grisha Yeager, found him and gave him the key to his basement, instructing Eren to find it at all costs and retake Wall Maria.[ He then injected Eren with a Titan serum."

console.log(getCharset(message) , getPartCount(message) , getCharacterCount(message));