<commit_before>import path from 'path';
import sharp from 'sharp';
import {
  ensureDir,
  ensureFile,
  move,
  remove,
  unlink,
  createWriteStream,
  createReadStream
} from 'fs-extra';
import { slugify } from '@shared/slugify';
import { FileUpload } from 'graphql-upload';

import { API_URL } from '../config/env';
import { uploadFile, useS3 } from './s3-upload';

export function isValidThumb(thumb) {
  return thumb !== null && thumb !== '';
}

/**
 * Stores a GraphQL file upload. The image will be stored either on S3 or in the filesystem.
 * @param {{file: FileUpload}} options
 * @returns image metadata
 */
export async function storeImage({
  file,<commit_msg>fix(api): remove unused imports<commit_after>import path from 'path';
import sharp from 'sharp';
import {
  ensureDir,
  ensureFile,
  move,
  remove,
  unlink,
  createWriteStream
} from 'fs-extra';
import { slugify } from '@shared/slugify';

import { API_URL } from '../config/env';
import { uploadFile, useS3 } from './s3-upload';

export function isValidThumb(thumb) {
  return thumb !== null && thumb !== '';
}

/**
 * Stores a GraphQL file upload. The image will be stored either on S3 or in the filesystem.
 * @param {{file: FileUpload}} options
 * @returns image metadata
 */
export async function storeImage({
  file,
{'fraction_non_alphanumeric': 0.1308698999230177, 'fraction_numerical': 0.004618937644341801, 'mean_word_length': 4.118110236220472, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6250967', 'n_tokens_mistral': 402, 'n_tokens_neox': 395, 'n_words': 139}