
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
grab is a fetch like javascript api for retreiving data with builtin automatic caching, path revalidation, support for fetching data using SSR and support for React Query
Grabber is a JavaScript data-fetching utility that supports automatic caching, time-based revalidation, Server-Side Rendering (SSR), and React Query integration. It allows developers to fetch data with ease while ensuring that resources are cached and revalidated periodically.
Install the Grabber package via npm:
npm install grabbr
Import and use the grab function for fetching data with revalidation.
import grab from 'grabber';
async function fetchData() {
const data = await grab('/api/data', 6000); // Revalidate every 6000ms
console.log(data);
}
Or you can use grab with options for full control of the grab
async function getPosts() {
const headers = {
'Authorization': 'Bearer your_token_here',
'Content-Type': 'application/json',
};
const body = {
JSON.stringify({
username: 'example_user',
message: 'Hello, world!',
});
}
const data = await grab('api/posts', 60000, {
"method": 'GET',
headers,
body
});
}
Grab supports SSR in next.js
import { grabSSR } from 'grabber';
export async function getServerSideProps() {
const data = await grabSSR('/api/data', 6000); // Revalidate every 6000ms
return {
props: { data },
};
}
export default function MyPage({ data }) {
return (
<div>
<h1>SSR Data Fetching</h1>
<pre>{JSON.stringify(data, null, 2)}</pre>
</div>
);
}
You can use grabber with react query also
// Example component using grab with React Query
export function MyComponent() {
const { data, error, isLoading } = useGrabQuery('/api/data', 6000); // Revalidate every 6 seconds
if (isLoading) {
return <div>Loading...</div>;
} else if (error instanceof Error) {
return <div>Error: {error.message}</div>;
} else {
return (
<div>
<h1>Data:</h1>
<pre>{JSON.stringify(data, null, 2)}</pre>
</div>
);
}
}
// Wrap your application with the QueryClientProvider
function App() {
return (
<QueryClientProvider client={queryClient}>
<MyComponent />
</QueryClientProvider>
);
}
export default App;
FAQs
grab is a fetch like javascript api for retreiving data with builtin automatic caching, path revalidation, support for fetching data using SSR and support for React Query
The npm package grabbr receives a total of 1 weekly downloads. As such, grabbr popularity was classified as not popular.
We found that grabbr demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?

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.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.